@next-md-blog/core 1.0.2 → 1.0.3

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.
Files changed (42) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +39 -210
  3. package/dist/components/BlogPostSEO.d.ts +3 -1
  4. package/dist/components/BlogPostSEO.d.ts.map +1 -1
  5. package/dist/components/BlogPostSEO.js +6 -4
  6. package/dist/components/MarkdownContent.d.ts +5 -6
  7. package/dist/components/MarkdownContent.d.ts.map +1 -1
  8. package/dist/components/MarkdownContent.js +8 -4
  9. package/dist/components/markdown/img.d.ts.map +1 -1
  10. package/dist/components/markdown/img.js +4 -1
  11. package/dist/core/config.d.ts +1 -1
  12. package/dist/core/config.js +1 -1
  13. package/dist/core/organization-schema.d.ts +22 -0
  14. package/dist/core/organization-schema.d.ts.map +1 -0
  15. package/dist/core/organization-schema.js +83 -0
  16. package/dist/core/seo-feeds.d.ts +2 -12
  17. package/dist/core/seo-feeds.d.ts.map +1 -1
  18. package/dist/core/seo-feeds.js +4 -34
  19. package/dist/core/seo-metadata.d.ts.map +1 -1
  20. package/dist/core/seo-metadata.js +16 -12
  21. package/dist/core/seo-schema.d.ts +13 -1
  22. package/dist/core/seo-schema.d.ts.map +1 -1
  23. package/dist/core/seo-schema.js +42 -13
  24. package/dist/core/seo-utils.d.ts +19 -7
  25. package/dist/core/seo-utils.d.ts.map +1 -1
  26. package/dist/core/seo-utils.js +65 -7
  27. package/dist/core/seo.d.ts +8 -4
  28. package/dist/core/seo.d.ts.map +1 -1
  29. package/dist/core/seo.js +6 -4
  30. package/dist/core/sitemap-data.d.ts +18 -0
  31. package/dist/core/sitemap-data.d.ts.map +1 -0
  32. package/dist/core/sitemap-data.js +42 -0
  33. package/dist/core/types.d.ts +21 -0
  34. package/dist/core/types.d.ts.map +1 -1
  35. package/dist/core/utils.js +2 -2
  36. package/dist/index.d.ts +4 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +2 -1
  39. package/dist/next.d.ts +19 -0
  40. package/dist/next.d.ts.map +1 -0
  41. package/dist/next.js +44 -0
  42. package/package.json +33 -28
package/dist/next.js ADDED
@@ -0,0 +1,44 @@
1
+ import { NextResponse } from 'next/server';
2
+ import { getBlogSitemapEntries } from './core/sitemap-data.js';
3
+ import { getConfig } from './core/config.js';
4
+ import { generateRSSFeed } from './core/seo-feeds.js';
5
+ /**
6
+ * Blog URLs for `app/sitemap.ts` (`export default` should return this or merge with static routes).
7
+ */
8
+ export function getBlogSitemap(posts, config) {
9
+ return getBlogSitemapEntries(posts, config ?? getConfig());
10
+ }
11
+ /**
12
+ * Default robots rules + sitemap URL for `app/robots.ts`.
13
+ */
14
+ export function getBlogRobots(config) {
15
+ const c = config ?? getConfig();
16
+ const base = c.siteUrl?.replace(/\/$/, '') || '';
17
+ return {
18
+ rules: {
19
+ userAgent: '*',
20
+ allow: '/',
21
+ },
22
+ ...(base ? { sitemap: `${base}/sitemap.xml` } : {}),
23
+ };
24
+ }
25
+ /**
26
+ * `NextResponse` for `app/feed.xml/route.ts` with RSS XML from `generateRSSFeed`.
27
+ */
28
+ export function createRssFeedResponse(posts, config, init) {
29
+ const xml = generateRSSFeed(posts, config);
30
+ const headers = new Headers(init?.headers);
31
+ if (!headers.has('Content-Type')) {
32
+ headers.set('Content-Type', 'application/xml; charset=utf-8');
33
+ }
34
+ if (!headers.has('Cache-Control')) {
35
+ headers.set('Cache-Control', 'public, s-maxage=3600, stale-while-revalidate');
36
+ }
37
+ return new NextResponse(xml, {
38
+ status: 200,
39
+ ...init,
40
+ headers,
41
+ });
42
+ }
43
+ export { getBlogSitemapEntries } from './core/sitemap-data.js';
44
+ export { generateOrganizationSchema } from './core/organization-schema.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-md-blog/core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A React library for parsing and displaying markdown blog posts in Next.js",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -10,6 +10,10 @@
10
10
  ".": {
11
11
  "import": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts"
13
+ },
14
+ "./next": {
15
+ "import": "./dist/next.js",
16
+ "types": "./dist/next.d.ts"
13
17
  }
14
18
  },
15
19
  "files": [
@@ -17,15 +21,6 @@
17
21
  "README.md",
18
22
  "LICENSE"
19
23
  ],
20
- "scripts": {
21
- "build": "tsc",
22
- "dev": "tsc --watch",
23
- "prepare": "npm run build",
24
- "test": "vitest run",
25
- "test:watch": "vitest",
26
- "test:coverage": "vitest run --coverage",
27
- "prepublishOnly": "npm run build && npm run test"
28
- },
29
24
  "keywords": [
30
25
  "react",
31
26
  "nextjs",
@@ -34,16 +29,16 @@
34
29
  "mdx",
35
30
  "content"
36
31
  ],
37
- "author": "florianamette",
32
+ "author": "next-md-blog",
38
33
  "license": "MIT",
39
34
  "repository": {
40
35
  "type": "git",
41
- "url": "https://github.com/florianamette/next-mdx-blog.git",
36
+ "url": "https://github.com/next-md-blog/next-md-blog.git",
42
37
  "directory": "packages/core"
43
38
  },
44
- "homepage": "https://github.com/florianamette/next-mdx-blog#readme",
39
+ "homepage": "https://www.next-md-blog.com",
45
40
  "bugs": {
46
- "url": "https://github.com/florianamette/next-mdx-blog/issues"
41
+ "url": "https://github.com/next-md-blog/next-md-blog/issues"
47
42
  },
48
43
  "publishConfig": {
49
44
  "access": "public"
@@ -53,28 +48,38 @@
53
48
  "c12": "^2.0.4",
54
49
  "gray-matter": "^4.0.3",
55
50
  "react-markdown": "^10.1.0",
56
- "rehype-react": "^7.0.0",
51
+ "rehype-react": "^8.0.0",
57
52
  "remark": "^15.0.1",
58
53
  "remark-emoji": "^5.0.2",
59
- "remark-gfm": "^4.0.0",
60
- "remark-rehype": "^11.1.1",
61
- "tailwindcss": "^4.0.0",
62
- "unist-util-visit": "^5.0.0"
54
+ "remark-gfm": "^4.0.1",
55
+ "remark-rehype": "^11.1.2",
56
+ "tailwindcss": "^4.2.2",
57
+ "unist-util-visit": "^5.1.0"
63
58
  },
64
59
  "devDependencies": {
60
+ "next": "^16.2.1",
65
61
  "@semantic-release/changelog": "^6.0.3",
66
62
  "@semantic-release/git": "^10.0.1",
67
- "@types/node": "^20.0.0",
68
- "@types/react": "^18.0.0",
69
- "@types/react-dom": "^18.0.0",
70
- "@vitest/coverage-v8": "^4.0.8",
71
- "semantic-release": "^23.0.0",
72
- "typescript": "^5.0.0",
73
- "vitest": "^4.0.8"
63
+ "@types/node": "^22.19.0",
64
+ "@types/react": "^19.2.0",
65
+ "@types/react-dom": "^19.2.0",
66
+ "@vitest/coverage-v8": "^4.1.2",
67
+ "semantic-release": "^25.0.3",
68
+ "typescript": "^5.9.3",
69
+ "vitest": "^4.1.2"
74
70
  },
75
71
  "peerDependencies": {
76
- "next": "^16.0.1",
72
+ "next": "^16.2.0",
77
73
  "react": "^19.2.0",
78
74
  "react-dom": "^19.2.0"
75
+ },
76
+ "scripts": {
77
+ "lint": "pnpm -C ../.. exec eslint packages/core",
78
+ "typecheck": "tsc --noEmit",
79
+ "build": "tsc",
80
+ "dev": "tsc --watch",
81
+ "test": "vitest run",
82
+ "test:watch": "vitest",
83
+ "test:coverage": "vitest run --coverage"
79
84
  }
80
- }
85
+ }