@haroonwaves/blog-kit-core 1.2.9 → 1.3.1
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.
- package/dist/index.cjs +0 -25
- package/dist/index.d.cts +1 -21
- package/dist/index.d.ts +1 -21
- package/dist/index.js +0 -23
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -30,8 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
-
extractBlog: () => extractBlog,
|
|
34
|
-
extractBlogMeta: () => extractBlogMeta,
|
|
35
33
|
getAllBlogsMeta: () => getAllBlogsMeta,
|
|
36
34
|
getBlog: () => getBlog
|
|
37
35
|
});
|
|
@@ -42,27 +40,6 @@ var import_fs = __toESM(require("fs"), 1);
|
|
|
42
40
|
var import_path = __toESM(require("path"), 1);
|
|
43
41
|
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
44
42
|
var import_reading_time = __toESM(require("reading-time"), 1);
|
|
45
|
-
function extractBlogMeta(content, slug) {
|
|
46
|
-
const { data, content: BlogContent } = (0, import_gray_matter.default)(content);
|
|
47
|
-
const readingTimeText = (0, import_reading_time.default)(BlogContent).text;
|
|
48
|
-
return {
|
|
49
|
-
slug,
|
|
50
|
-
...data,
|
|
51
|
-
readingTime: readingTimeText
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function extractBlog(content, slug) {
|
|
55
|
-
const { data, content: BlogContent } = (0, import_gray_matter.default)(content);
|
|
56
|
-
const readingTimeText = (0, import_reading_time.default)(BlogContent).text;
|
|
57
|
-
return {
|
|
58
|
-
metadata: {
|
|
59
|
-
...data,
|
|
60
|
-
slug,
|
|
61
|
-
readingTime: readingTimeText
|
|
62
|
-
},
|
|
63
|
-
content: BlogContent
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
43
|
function getAllBlogsMeta(config) {
|
|
67
44
|
const blogDirectory = import_path.default.join(config.contentDirectory, config.blogSubdirectory || "blog");
|
|
68
45
|
if (!import_fs.default.existsSync(blogDirectory)) {
|
|
@@ -106,8 +83,6 @@ function getBlog(slug, config) {
|
|
|
106
83
|
}
|
|
107
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
108
85
|
0 && (module.exports = {
|
|
109
|
-
extractBlog,
|
|
110
|
-
extractBlogMeta,
|
|
111
86
|
getAllBlogsMeta,
|
|
112
87
|
getBlog
|
|
113
88
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -15,26 +15,6 @@ interface BlogConfig {
|
|
|
15
15
|
blogSubdirectory?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Client-side compatible: Extract blog metadata from raw blog content.
|
|
20
|
-
* This function works in browser environments (pure React) where you have
|
|
21
|
-
* the blog content as a string (e.g., fetched from an API or imported).
|
|
22
|
-
*
|
|
23
|
-
* @param content - Raw blog content string
|
|
24
|
-
* @param slug - Blog post slug/identifier
|
|
25
|
-
* @returns Parsed blog metadata
|
|
26
|
-
*/
|
|
27
|
-
declare function extractBlogMeta(content: string, slug: string): BlogMeta;
|
|
28
|
-
/**
|
|
29
|
-
* Client-side compatible: Extract blog data from raw blog content.
|
|
30
|
-
* This function works in browser environments (pure React) where you have
|
|
31
|
-
* the blog content as a string (e.g., fetched from an API or imported).
|
|
32
|
-
*
|
|
33
|
-
* @param content - Raw Blog content string
|
|
34
|
-
* @param slug - Blog post slug/identifier
|
|
35
|
-
* @returns Parsed blog data with metadata and content
|
|
36
|
-
*/
|
|
37
|
-
declare function extractBlog(content: string, slug: string): Blog;
|
|
38
18
|
/**
|
|
39
19
|
* SSR and SSG only: Get all blogs metadata from the filesystem.
|
|
40
20
|
* This function requires Node.js fs module and only works in server environments
|
|
@@ -55,4 +35,4 @@ declare function getAllBlogsMeta(config: BlogConfig): BlogMeta[];
|
|
|
55
35
|
*/
|
|
56
36
|
declare function getBlog(slug: string, config: BlogConfig): Blog | null;
|
|
57
37
|
|
|
58
|
-
export { type Blog, type BlogConfig, type BlogMeta,
|
|
38
|
+
export { type Blog, type BlogConfig, type BlogMeta, getAllBlogsMeta, getBlog };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,26 +15,6 @@ interface BlogConfig {
|
|
|
15
15
|
blogSubdirectory?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Client-side compatible: Extract blog metadata from raw blog content.
|
|
20
|
-
* This function works in browser environments (pure React) where you have
|
|
21
|
-
* the blog content as a string (e.g., fetched from an API or imported).
|
|
22
|
-
*
|
|
23
|
-
* @param content - Raw blog content string
|
|
24
|
-
* @param slug - Blog post slug/identifier
|
|
25
|
-
* @returns Parsed blog metadata
|
|
26
|
-
*/
|
|
27
|
-
declare function extractBlogMeta(content: string, slug: string): BlogMeta;
|
|
28
|
-
/**
|
|
29
|
-
* Client-side compatible: Extract blog data from raw blog content.
|
|
30
|
-
* This function works in browser environments (pure React) where you have
|
|
31
|
-
* the blog content as a string (e.g., fetched from an API or imported).
|
|
32
|
-
*
|
|
33
|
-
* @param content - Raw Blog content string
|
|
34
|
-
* @param slug - Blog post slug/identifier
|
|
35
|
-
* @returns Parsed blog data with metadata and content
|
|
36
|
-
*/
|
|
37
|
-
declare function extractBlog(content: string, slug: string): Blog;
|
|
38
18
|
/**
|
|
39
19
|
* SSR and SSG only: Get all blogs metadata from the filesystem.
|
|
40
20
|
* This function requires Node.js fs module and only works in server environments
|
|
@@ -55,4 +35,4 @@ declare function getAllBlogsMeta(config: BlogConfig): BlogMeta[];
|
|
|
55
35
|
*/
|
|
56
36
|
declare function getBlog(slug: string, config: BlogConfig): Blog | null;
|
|
57
37
|
|
|
58
|
-
export { type Blog, type BlogConfig, type BlogMeta,
|
|
38
|
+
export { type Blog, type BlogConfig, type BlogMeta, getAllBlogsMeta, getBlog };
|
package/dist/index.js
CHANGED
|
@@ -3,27 +3,6 @@ import fs from "fs";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import matter from "gray-matter";
|
|
5
5
|
import readingTime from "reading-time";
|
|
6
|
-
function extractBlogMeta(content, slug) {
|
|
7
|
-
const { data, content: BlogContent } = matter(content);
|
|
8
|
-
const readingTimeText = readingTime(BlogContent).text;
|
|
9
|
-
return {
|
|
10
|
-
slug,
|
|
11
|
-
...data,
|
|
12
|
-
readingTime: readingTimeText
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function extractBlog(content, slug) {
|
|
16
|
-
const { data, content: BlogContent } = matter(content);
|
|
17
|
-
const readingTimeText = readingTime(BlogContent).text;
|
|
18
|
-
return {
|
|
19
|
-
metadata: {
|
|
20
|
-
...data,
|
|
21
|
-
slug,
|
|
22
|
-
readingTime: readingTimeText
|
|
23
|
-
},
|
|
24
|
-
content: BlogContent
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
6
|
function getAllBlogsMeta(config) {
|
|
28
7
|
const blogDirectory = path.join(config.contentDirectory, config.blogSubdirectory || "blog");
|
|
29
8
|
if (!fs.existsSync(blogDirectory)) {
|
|
@@ -66,8 +45,6 @@ function getBlog(slug, config) {
|
|
|
66
45
|
};
|
|
67
46
|
}
|
|
68
47
|
export {
|
|
69
|
-
extractBlog,
|
|
70
|
-
extractBlogMeta,
|
|
71
48
|
getAllBlogsMeta,
|
|
72
49
|
getBlog
|
|
73
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haroonwaves/blog-kit-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
"markdown",
|
|
14
14
|
"react",
|
|
15
15
|
"nextjs",
|
|
16
|
+
"nextjs-blog",
|
|
16
17
|
"blog-engine",
|
|
17
18
|
"ssg",
|
|
19
|
+
"server-side",
|
|
18
20
|
"blog-kit"
|
|
19
21
|
],
|
|
20
22
|
"author": "Haroon (https://github.com/haroonwaves)",
|