@s-blog/engine 0.1.2 → 0.2.0

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 (2) hide show
  1. package/README.md +80 -0
  2. package/package.json +6 -5
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @s-blog/engine
2
+
3
+ Rust-powered data engine for [s-blog](https://github.com/Suzichen/s-blog) — handles Markdown parsing, image processing, SEO/feed generation with native performance.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @s-blog/engine
9
+ ```
10
+
11
+ The correct native binary for your platform will be installed automatically.
12
+
13
+ ### Supported Platforms
14
+
15
+ | OS | Arch | Package |
16
+ |---------|-------|----------------------------------|
17
+ | Windows | x64 | `@s-blog/engine-win32-x64-msvc` |
18
+ | macOS | ARM64 | `@s-blog/engine-darwin-arm64` |
19
+ | Linux | x64 | `@s-blog/engine-linux-x64-gnu` |
20
+
21
+ > macOS Intel users: the ARM64 binary runs seamlessly via Rosetta 2.
22
+
23
+ ## API
24
+
25
+ ```js
26
+ const {
27
+ generatePostsData,
28
+ generateAlbumsData,
29
+ generateSeoPages,
30
+ generateSitemap,
31
+ generateRss,
32
+ generateRobots,
33
+ } = require('@s-blog/engine')
34
+ ```
35
+
36
+ ### `generatePostsData(postsDir, outputDir, configJson) → string`
37
+
38
+ Scans `postsDir` for Markdown files, parses frontmatter, generates `manifest.json`, and copies `.md` files to `outputDir/posts/`. Returns the manifest as a JSON string.
39
+
40
+ ### `generateAlbumsData(albumsDir, outputDir, albumConfigJson, siteConfigJson) → string`
41
+
42
+ Generates album index and per-album detail JSON files, including WebP thumbnail generation and EXIF extraction. Returns the albums-index JSON string.
43
+
44
+ ### `generateSeoPages(manifestJson, templatePath, outputDir, configJson) → number`
45
+
46
+ Generates an SEO-optimized HTML page for each post (Open Graph, Twitter Card, JSON-LD). Returns the number of pages generated.
47
+
48
+ ### `generateSitemap(manifestJson, outputPath, configJson) → void`
49
+
50
+ Generates `sitemap.xml` conforming to the Sitemaps protocol.
51
+
52
+ ### `generateRss(manifestJson, outputPath, configJson) → void`
53
+
54
+ Generates `rss.xml` conforming to RSS 2.0.
55
+
56
+ ### `generateRobots(outputPath, configJson) → void`
57
+
58
+ Generates `robots.txt` with sitemap reference.
59
+
60
+ ## Config Format
61
+
62
+ All `configJson` parameters accept a JSON string matching `config.json`:
63
+
64
+ ```json
65
+ {
66
+ "title": "My Blog",
67
+ "description": "A personal blog",
68
+ "logo": "/logo.png",
69
+ "favicon": "/favicon.ico",
70
+ "siteUrl": "https://example.com",
71
+ "author": "Author",
72
+ "language": "en",
73
+ "timezone": "Asia/Tokyo",
74
+ "basePath": "/"
75
+ }
76
+ ```
77
+
78
+ ## License
79
+
80
+ MIT
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@s-blog/engine",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Rust-powered data engine for s-blog — Markdown parsing, image processing, SEO/feed generation",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "files": [
9
9
  "index.js",
10
- "index.d.ts"
10
+ "index.d.ts",
11
+ "README.md"
11
12
  ],
12
13
  "napi": {
13
14
  "binaryName": "s-blog-engine-napi",
@@ -22,9 +23,9 @@
22
23
  "build:debug": "napi build --platform"
23
24
  },
24
25
  "optionalDependencies": {
25
- "@s-blog/engine-win32-x64-msvc": "0.1.2",
26
- "@s-blog/engine-darwin-arm64": "0.1.2",
27
- "@s-blog/engine-linux-x64-gnu": "0.1.2"
26
+ "@s-blog/engine-win32-x64-msvc": "0.2.0",
27
+ "@s-blog/engine-darwin-arm64": "0.2.0",
28
+ "@s-blog/engine-linux-x64-gnu": "0.2.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@napi-rs/cli": "^2.18.4"