You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@power-seo/core

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@power-seo/core - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+4
-4
package.json
{
"name": "@power-seo/core",
"version": "1.0.0",
"version": "1.0.1",
"description": "Framework-agnostic SEO analysis engines, types, and utilities",

@@ -9,5 +9,5 @@ "license": "MIT",

".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
"require": "./dist/index.cjs"
}

@@ -49,3 +49,3 @@ },

"type": "git",
"url": "https://github.com/cybercraftbd/ccbd-power-seo.git",
"url": "git+https://github.com/CyberCraftBD/power-seo.git",
"directory": "packages/core"

@@ -52,0 +52,0 @@ },

+144
-110

@@ -13,2 +13,8 @@ # @power-seo/core — Framework-Agnostic SEO Utilities for TypeScript & React

## Documentation
- **Package docs:** [`apps/docs/src/content/docs/packages/core.mdx`](../../apps/docs/src/content/docs/packages/core.mdx)
- **Ecosystem overview:** [`README.md`](../../README.md)
- **Contributing guide:** [`CONTRIBUTING.md`](../../CONTRIBUTING.md)
## Features

@@ -64,6 +70,10 @@

const tags = buildMetaTags({ title: 'My Page', description: 'Page description', robots: { index: true, follow: true } });
const tags = buildMetaTags({
title: 'My Page',
description: 'Page description',
robots: { index: true, follow: true },
});
const robots = buildRobotsContent({ index: false, maxSnippet: 150 }); // → "noindex, max-snippet:150"
const valid = validateTitle('My Page Title'); // { valid: true, length: 14, pixelWidth: 95 }
const slug = toSlug('My Blog Post!'); // → "my-blog-post"
const valid = validateTitle('My Page Title'); // { valid: true, length: 14, pixelWidth: 95 }
const slug = toSlug('My Blog Post!'); // → "my-blog-post"
```

@@ -76,3 +86,9 @@

```ts
import { buildMetaTags, buildLinkTags, buildOpenGraphTags, buildTwitterTags, buildHreflangTags } from '@power-seo/core';
import {
buildMetaTags,
buildLinkTags,
buildOpenGraphTags,
buildTwitterTags,
buildHreflangTags,
} from '@power-seo/core';

@@ -132,14 +148,14 @@ const meta = buildMetaTags({

| Directive | Type | Description |
|-----------|------|-------------|
| `index` | `boolean` | `true` → `index`, `false` → `noindex` |
| `follow` | `boolean` | `true` → `follow`, `false` → `nofollow` |
| `noarchive` | `boolean` | Prevent cached version in search results |
| `nosnippet` | `boolean` | Prevent text/video snippet in results |
| `noimageindex` | `boolean` | Prevent page images from being indexed |
| `notranslate` | `boolean` | Prevent Google Translate offer |
| `maxSnippet` | `number` | Max text snippet length (e.g. `150`) |
| `maxImagePreview` | `'none' \| 'standard' \| 'large'` | Max image preview size |
| `maxVideoPreview` | `number` | Max video preview duration in seconds |
| `unavailableAfter` | `string` | Date after which to remove page from results |
| Directive | Type | Description |
| ------------------ | --------------------------------- | -------------------------------------------- |
| `index` | `boolean` | `true` → `index`, `false` → `noindex` |
| `follow` | `boolean` | `true` → `follow`, `false` → `nofollow` |
| `noarchive` | `boolean` | Prevent cached version in search results |
| `nosnippet` | `boolean` | Prevent text/video snippet in results |
| `noimageindex` | `boolean` | Prevent page images from being indexed |
| `notranslate` | `boolean` | Prevent Google Translate offer |
| `maxSnippet` | `number` | Max text snippet length (e.g. `150`) |
| `maxImagePreview` | `'none' \| 'standard' \| 'large'` | Max image preview size |
| `maxVideoPreview` | `number` | Max video preview duration in seconds |
| `unavailableAfter` | `string` | Date after which to remove page from results |

@@ -186,8 +202,8 @@ ### Title Template Engine

normalizeUrl('https://example.com/PATH?utm_source=x'); // → "https://example.com/path"
toSlug('My Blog Post!'); // → "my-blog-post"
toSlug('My Blog Post!'); // → "my-blog-post"
stripTrackingParams('https://example.com?utm_source=google&page=1'); // → "https://example.com?page=1"
ensureTrailingSlash('https://example.com/blog'); // → "https://example.com/blog/"
removeTrailingSlash('https://example.com/blog/'); // → "https://example.com/blog"
isAbsoluteUrl('https://example.com'); // → true
isAbsoluteUrl('/relative/path'); // → false
ensureTrailingSlash('https://example.com/blog'); // → "https://example.com/blog/"
removeTrailingSlash('https://example.com/blog/'); // → "https://example.com/blog"
isAbsoluteUrl('https://example.com'); // → true
isAbsoluteUrl('/relative/path'); // → false
```

@@ -198,10 +214,18 @@

```ts
import { getTextStatistics, stripHtml, getWords, getSentences, countSyllables } from '@power-seo/core';
import {
getTextStatistics,
stripHtml,
getWords,
getSentences,
countSyllables,
} from '@power-seo/core';
const stats = getTextStatistics('<h1>Hello</h1><p>This is a sample paragraph with several words.</p>');
const stats = getTextStatistics(
'<h1>Hello</h1><p>This is a sample paragraph with several words.</p>',
);
// { wordCount: 9, sentenceCount: 1, paragraphCount: 1, syllableCount: 14, avgWordsPerSentence: 9 }
stripHtml('<p>Hello <strong>world</strong></p>'); // → "Hello world"
getWords('Hello world'); // → ["Hello", "world"]
countSyllables('beautiful'); // → 3
getWords('Hello world'); // → ["Hello", "world"]
countSyllables('beautiful'); // → 3
```

@@ -212,3 +236,7 @@

```ts
import { calculateKeywordDensity, countKeywordOccurrences, analyzeKeyphraseOccurrences } from '@power-seo/core';
import {
calculateKeywordDensity,
countKeywordOccurrences,
analyzeKeyphraseOccurrences,
} from '@power-seo/core';

@@ -220,3 +248,3 @@ calculateKeywordDensity('react seo is great for react apps', 'react'); // → 0.1667 (16.67%)

'Best coffee shops in NYC. The coffee shops on Fifth Avenue are particularly good.',
'coffee shops'
'coffee shops',
);

@@ -229,10 +257,16 @@ // { count: 2, density: 0.1538, positions: [1, 7], distribution: 'good' }

```ts
import { TITLE_MAX_LENGTH, META_DESCRIPTION_MAX_LENGTH, OG_IMAGE, KEYWORD_DENSITY, READABILITY } from '@power-seo/core';
import {
TITLE_MAX_LENGTH,
META_DESCRIPTION_MAX_LENGTH,
OG_IMAGE,
KEYWORD_DENSITY,
READABILITY,
} from '@power-seo/core';
TITLE_MAX_LENGTH; // 60
META_DESCRIPTION_MAX_LENGTH; // 158
OG_IMAGE.MIN_WIDTH; // 1200
OG_IMAGE.MIN_HEIGHT; // 630
KEYWORD_DENSITY.MIN; // 0.005 (0.5%)
KEYWORD_DENSITY.MAX; // 0.03 (3%)
TITLE_MAX_LENGTH; // 60
META_DESCRIPTION_MAX_LENGTH; // 158
OG_IMAGE.MIN_WIDTH; // 1200
OG_IMAGE.MIN_HEIGHT; // 630
KEYWORD_DENSITY.MIN; // 0.005 (0.5%)
KEYWORD_DENSITY.MAX; // 0.03 (3%)
```

@@ -244,23 +278,23 @@

| Function | Signature | Description |
|----------|-----------|-------------|
| `buildMetaTags` | `(config: MetaConfig) => MetaTag[]` | Generate meta tag objects from SEO config |
| `buildLinkTags` | `(config: LinkConfig) => LinkTag[]` | Generate link tag objects (canonical, alternate) |
| `buildOpenGraphTags` | `(config: OpenGraphConfig) => MetaTag[]` | Generate Open Graph `og:*` meta tags |
| `buildTwitterTags` | `(config: TwitterConfig) => MetaTag[]` | Generate Twitter Card `twitter:*` meta tags |
| `buildHreflangTags` | `(entries: HreflangEntry[]) => LinkTag[]` | Generate hreflang `<link rel="alternate">` tags |
| `resolveTitle` | `(title: string, template?: string) => string` | Resolve title with optional template |
| Function | Signature | Description |
| -------------------- | ---------------------------------------------- | ------------------------------------------------ |
| `buildMetaTags` | `(config: MetaConfig) => MetaTag[]` | Generate meta tag objects from SEO config |
| `buildLinkTags` | `(config: LinkConfig) => LinkTag[]` | Generate link tag objects (canonical, alternate) |
| `buildOpenGraphTags` | `(config: OpenGraphConfig) => MetaTag[]` | Generate Open Graph `og:*` meta tags |
| `buildTwitterTags` | `(config: TwitterConfig) => MetaTag[]` | Generate Twitter Card `twitter:*` meta tags |
| `buildHreflangTags` | `(entries: HreflangEntry[]) => LinkTag[]` | Generate hreflang `<link rel="alternate">` tags |
| `resolveTitle` | `(title: string, template?: string) => string` | Resolve title with optional template |
### Robots
| Function | Signature | Description |
|----------|-----------|-------------|
| `buildRobotsContent` | `(directive: RobotsDirective) => string` | Build robots meta content string |
| `parseRobotsContent` | `(content: string) => RobotsDirective` | Parse robots string into `RobotsDirective` |
| Function | Signature | Description |
| -------------------- | ---------------------------------------- | ------------------------------------------ |
| `buildRobotsContent` | `(directive: RobotsDirective) => string` | Build robots meta content string |
| `parseRobotsContent` | `(content: string) => RobotsDirective` | Parse robots string into `RobotsDirective` |
### Title
| Function | Signature | Description |
|----------|-----------|-------------|
| `applyTitleTemplate` | `(title: string, template: string) => string` | Apply `%s` template to title |
| Function | Signature | Description |
| --------------------- | -------------------------------------------------- | ------------------------------ |
| `applyTitleTemplate` | `(title: string, template: string) => string` | Apply `%s` template to title |
| `createTitleTemplate` | `(options: TitleTemplateOptions) => TitleTemplate` | Create reusable title template |

@@ -270,52 +304,52 @@

| Function | Signature | Description |
|----------|-----------|-------------|
| `validateTitle` | `(title: string) => ValidationResult` | Validate title length and pixel width |
| `validateMetaDescription` | `(description: string) => ValidationResult` | Validate description length and pixel width |
| `calculatePixelWidth` | `(text: string) => number` | Calculate pixel width using Google's character width table |
| Function | Signature | Description |
| ------------------------- | ------------------------------------------- | ---------------------------------------------------------- |
| `validateTitle` | `(title: string) => ValidationResult` | Validate title length and pixel width |
| `validateMetaDescription` | `(description: string) => ValidationResult` | Validate description length and pixel width |
| `calculatePixelWidth` | `(text: string) => number` | Calculate pixel width using Google's character width table |
### URL Utilities
| Function | Signature | Description |
|----------|-----------|-------------|
| `resolveCanonical` | `(url: string, base: string) => string` | Resolve canonical URL against base |
| `normalizeUrl` | `(url: string) => string` | Normalize URL (lowercase, remove trailing slash) |
| `ensureTrailingSlash` | `(url: string) => string` | Add trailing slash if missing |
| `removeTrailingSlash` | `(url: string) => string` | Remove trailing slash if present |
| `stripQueryParams` | `(url: string) => string` | Remove all query parameters |
| `stripTrackingParams` | `(url: string) => string` | Remove UTM and tracking parameters only |
| `isAbsoluteUrl` | `(url: string) => boolean` | Check if URL is absolute |
| `toSlug` | `(text: string) => string` | Convert text to URL-safe slug |
| Function | Signature | Description |
| --------------------- | --------------------------------------- | ------------------------------------------------ |
| `resolveCanonical` | `(url: string, base: string) => string` | Resolve canonical URL against base |
| `normalizeUrl` | `(url: string) => string` | Normalize URL (lowercase, remove trailing slash) |
| `ensureTrailingSlash` | `(url: string) => string` | Add trailing slash if missing |
| `removeTrailingSlash` | `(url: string) => string` | Remove trailing slash if present |
| `stripQueryParams` | `(url: string) => string` | Remove all query parameters |
| `stripTrackingParams` | `(url: string) => string` | Remove UTM and tracking parameters only |
| `isAbsoluteUrl` | `(url: string) => boolean` | Check if URL is absolute |
| `toSlug` | `(text: string) => string` | Convert text to URL-safe slug |
### Text Statistics
| Function | Signature | Description |
|----------|-----------|-------------|
| Function | Signature | Description |
| ------------------- | ---------------------------------- | --------------------------------------- |
| `getTextStatistics` | `(html: string) => TextStatistics` | Comprehensive text statistics from HTML |
| `stripHtml` | `(html: string) => string` | Remove HTML tags |
| `getWords` | `(text: string) => string[]` | Split into words array |
| `getSentences` | `(text: string) => string[]` | Split into sentences array |
| `getParagraphs` | `(text: string) => string[]` | Split into paragraphs array |
| `countSyllables` | `(word: string) => number` | Count syllables in a single word |
| `stripHtml` | `(html: string) => string` | Remove HTML tags |
| `getWords` | `(text: string) => string[]` | Split into words array |
| `getSentences` | `(text: string) => string[]` | Split into sentences array |
| `getParagraphs` | `(text: string) => string[]` | Split into paragraphs array |
| `countSyllables` | `(word: string) => number` | Count syllables in a single word |
### Keyword Analysis
| Function | Signature | Description |
|----------|-----------|-------------|
| `calculateKeywordDensity` | `(text: string, keyword: string) => number` | Keyword density as decimal (0.05 = 5%) |
| `countKeywordOccurrences` | `(text: string, keyword: string) => number` | Raw occurrence count |
| `analyzeKeyphraseOccurrences` | `(text: string, keyphrase: string) => KeyphraseAnalysis` | Detailed keyphrase analysis |
| Function | Signature | Description |
| ----------------------------- | -------------------------------------------------------- | -------------------------------------- |
| `calculateKeywordDensity` | `(text: string, keyword: string) => number` | Keyword density as decimal (0.05 = 5%) |
| `countKeywordOccurrences` | `(text: string, keyword: string) => number` | Raw occurrence count |
| `analyzeKeyphraseOccurrences` | `(text: string, keyphrase: string) => KeyphraseAnalysis` | Detailed keyphrase analysis |
### Core Types
| Type | Description |
|------|-------------|
| `MetaTag` | `{ name?: string; property?: string; content: string; httpEquiv?: string }` |
| `LinkTag` | `{ rel: string; href: string; hrefLang?: string; type?: string }` |
| `RobotsDirective` | Full robots directive configuration object |
| `MetaConfig` | Input config for `buildMetaTags()` |
| `OpenGraphConfig` | Input config for `buildOpenGraphTags()` |
| `TwitterConfig` | Input config for `buildTwitterTags()` |
| `ValidationResult` | `{ valid: boolean; length: number; pixelWidth: number; warnings: string[] }` |
| `TextStatistics` | `{ wordCount: number; sentenceCount: number; paragraphCount: number; syllableCount: number; avgWordsPerSentence: number }` |
| Type | Description |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `MetaTag` | `{ name?: string; property?: string; content: string; httpEquiv?: string }` |
| `LinkTag` | `{ rel: string; href: string; hrefLang?: string; type?: string }` |
| `RobotsDirective` | Full robots directive configuration object |
| `MetaConfig` | Input config for `buildMetaTags()` |
| `OpenGraphConfig` | Input config for `buildOpenGraphTags()` |
| `TwitterConfig` | Input config for `buildTwitterTags()` |
| `ValidationResult` | `{ valid: boolean; length: number; pixelWidth: number; warnings: string[] }` |
| `TextStatistics` | `{ wordCount: number; sentenceCount: number; paragraphCount: number; syllableCount: number; avgWordsPerSentence: number }` |

@@ -328,21 +362,21 @@ ---

| Package | Install | Description |
|---------|---------|-------------|
| [`@power-seo/core`](https://www.npmjs.com/package/@power-seo/core) | `npm i @power-seo/core` | Framework-agnostic utilities, types, validators, and constants |
| [`@power-seo/react`](https://www.npmjs.com/package/@power-seo/react) | `npm i @power-seo/react` | React SEO components — meta, Open Graph, Twitter Card, robots, breadcrumbs |
| [`@power-seo/meta`](https://www.npmjs.com/package/@power-seo/meta) | `npm i @power-seo/meta` | SSR meta helpers for Next.js App Router, Remix v2, and generic SSR |
| [`@power-seo/schema`](https://www.npmjs.com/package/@power-seo/schema) | `npm i @power-seo/schema` | Type-safe JSON-LD structured data — 20 builders + 18 React components |
| [`@power-seo/content-analysis`](https://www.npmjs.com/package/@power-seo/content-analysis) | `npm i @power-seo/content-analysis` | Yoast-style SEO content scoring engine with React components |
| [`@power-seo/readability`](https://www.npmjs.com/package/@power-seo/readability) | `npm i @power-seo/readability` | Readability scoring — Flesch-Kincaid, Gunning Fog, Coleman-Liau, ARI |
| [`@power-seo/preview`](https://www.npmjs.com/package/@power-seo/preview) | `npm i @power-seo/preview` | SERP, Open Graph, and Twitter/X Card preview generators |
| [`@power-seo/sitemap`](https://www.npmjs.com/package/@power-seo/sitemap) | `npm i @power-seo/sitemap` | XML sitemap generation, streaming, index splitting, and validation |
| [`@power-seo/redirects`](https://www.npmjs.com/package/@power-seo/redirects) | `npm i @power-seo/redirects` | Redirect engine with Next.js, Remix, and Express adapters |
| [`@power-seo/links`](https://www.npmjs.com/package/@power-seo/links) | `npm i @power-seo/links` | Link graph analysis — orphan detection, suggestions, equity scoring |
| [`@power-seo/audit`](https://www.npmjs.com/package/@power-seo/audit) | `npm i @power-seo/audit` | Full SEO audit engine — meta, content, structure, performance rules |
| [`@power-seo/images`](https://www.npmjs.com/package/@power-seo/images) | `npm i @power-seo/images` | Image SEO — alt text, lazy loading, format analysis, image sitemaps |
| [`@power-seo/ai`](https://www.npmjs.com/package/@power-seo/ai) | `npm i @power-seo/ai` | LLM-agnostic AI prompt templates and parsers for SEO tasks |
| [`@power-seo/analytics`](https://www.npmjs.com/package/@power-seo/analytics) | `npm i @power-seo/analytics` | Merge GSC + audit data, trend analysis, ranking insights, dashboard |
| [`@power-seo/search-console`](https://www.npmjs.com/package/@power-seo/search-console) | `npm i @power-seo/search-console` | Google Search Console API — OAuth2, service account, URL inspection |
| [`@power-seo/integrations`](https://www.npmjs.com/package/@power-seo/integrations) | `npm i @power-seo/integrations` | Semrush and Ahrefs API clients with rate limiting and pagination |
| [`@power-seo/tracking`](https://www.npmjs.com/package/@power-seo/tracking) | `npm i @power-seo/tracking` | GA4, Clarity, PostHog, Plausible, Fathom — scripts + consent management |
| Package | Install | Description |
| ------------------------------------------------------------------------------------------ | ----------------------------------- | -------------------------------------------------------------------------- |
| [`@power-seo/core`](https://www.npmjs.com/package/@power-seo/core) | `npm i @power-seo/core` | Framework-agnostic utilities, types, validators, and constants |
| [`@power-seo/react`](https://www.npmjs.com/package/@power-seo/react) | `npm i @power-seo/react` | React SEO components — meta, Open Graph, Twitter Card, robots, breadcrumbs |
| [`@power-seo/meta`](https://www.npmjs.com/package/@power-seo/meta) | `npm i @power-seo/meta` | SSR meta helpers for Next.js App Router, Remix v2, and generic SSR |
| [`@power-seo/schema`](https://www.npmjs.com/package/@power-seo/schema) | `npm i @power-seo/schema` | Type-safe JSON-LD structured data — 20 builders + 18 React components |
| [`@power-seo/content-analysis`](https://www.npmjs.com/package/@power-seo/content-analysis) | `npm i @power-seo/content-analysis` | Yoast-style SEO content scoring engine with React components |
| [`@power-seo/readability`](https://www.npmjs.com/package/@power-seo/readability) | `npm i @power-seo/readability` | Readability scoring — Flesch-Kincaid, Gunning Fog, Coleman-Liau, ARI |
| [`@power-seo/preview`](https://www.npmjs.com/package/@power-seo/preview) | `npm i @power-seo/preview` | SERP, Open Graph, and Twitter/X Card preview generators |
| [`@power-seo/sitemap`](https://www.npmjs.com/package/@power-seo/sitemap) | `npm i @power-seo/sitemap` | XML sitemap generation, streaming, index splitting, and validation |
| [`@power-seo/redirects`](https://www.npmjs.com/package/@power-seo/redirects) | `npm i @power-seo/redirects` | Redirect engine with Next.js, Remix, and Express adapters |
| [`@power-seo/links`](https://www.npmjs.com/package/@power-seo/links) | `npm i @power-seo/links` | Link graph analysis — orphan detection, suggestions, equity scoring |
| [`@power-seo/audit`](https://www.npmjs.com/package/@power-seo/audit) | `npm i @power-seo/audit` | Full SEO audit engine — meta, content, structure, performance rules |
| [`@power-seo/images`](https://www.npmjs.com/package/@power-seo/images) | `npm i @power-seo/images` | Image SEO — alt text, lazy loading, format analysis, image sitemaps |
| [`@power-seo/ai`](https://www.npmjs.com/package/@power-seo/ai) | `npm i @power-seo/ai` | LLM-agnostic AI prompt templates and parsers for SEO tasks |
| [`@power-seo/analytics`](https://www.npmjs.com/package/@power-seo/analytics) | `npm i @power-seo/analytics` | Merge GSC + audit data, trend analysis, ranking insights, dashboard |
| [`@power-seo/search-console`](https://www.npmjs.com/package/@power-seo/search-console) | `npm i @power-seo/search-console` | Google Search Console API — OAuth2, service account, URL inspection |
| [`@power-seo/integrations`](https://www.npmjs.com/package/@power-seo/integrations) | `npm i @power-seo/integrations` | Semrush and Ahrefs API clients with rate limiting and pagination |
| [`@power-seo/tracking`](https://www.npmjs.com/package/@power-seo/tracking) | `npm i @power-seo/tracking` | GA4, Clarity, PostHog, Plausible, Fathom — scripts + consent management |

@@ -355,9 +389,9 @@ ---

| | |
|---|---|
| **Website** | [ccbd.dev](https://ccbd.dev) |
| **GitHub** | [github.com/cybercraftbd](https://github.com/cybercraftbd) |
| | |
| -------------------- | -------------------------------------------------------------- |
| **Website** | [ccbd.dev](https://ccbd.dev) |
| **GitHub** | [github.com/cybercraftbd](https://github.com/cybercraftbd) |
| **npm Organization** | [npmjs.com/org/power-seo](https://www.npmjs.com/org/power-seo) |
| **Email** | [info@ccbd.dev](mailto:info@ccbd.dev) |
| **Email** | [info@ccbd.dev](mailto:info@ccbd.dev) |
© 2026 CyberCraft Bangladesh · Released under the [MIT License](../../LICENSE)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display