bunki 0.3.2 → 0.3.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.
- package/dist/cli.d.ts +2 -0
- package/dist/config.d.ts +11 -0
- package/dist/index.d.ts +9 -0
- package/dist/parser.d.ts +2 -0
- package/dist/server.d.ts +1 -0
- package/dist/site-generator.d.ts +20 -0
- package/dist/types.d.ts +158 -0
- package/dist/utils/css-processor.d.ts +27 -0
- package/dist/utils/file-utils.d.ts +6 -0
- package/dist/utils/image-uploader.d.ts +3 -0
- package/dist/utils/markdown-utils.d.ts +4 -0
- package/dist/utils/s3-uploader.d.ts +23 -0
- package/package.json +1 -1
package/dist/cli.d.ts
ADDED
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SiteConfig } from "./types";
|
|
2
|
+
export declare const DEFAULT_CONTENT_DIR: string;
|
|
3
|
+
export declare const DEFAULT_OUTPUT_DIR: string;
|
|
4
|
+
export declare const DEFAULT_TEMPLATES_DIR: string;
|
|
5
|
+
export declare const DEFAULT_CONFIG_TS: string;
|
|
6
|
+
export declare const DEFAULT_CONFIG_FILE: string;
|
|
7
|
+
export declare function configExists(configPath?: string): Promise<boolean>;
|
|
8
|
+
export declare function loadConfig(configPath?: string): Promise<SiteConfig>;
|
|
9
|
+
export declare function getDefaultConfig(): SiteConfig;
|
|
10
|
+
export declare function createDefaultConfig(configPath?: string): Promise<boolean>;
|
|
11
|
+
export declare function saveConfig(config: SiteConfig, configPath?: string): Promise<boolean>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export { SiteGenerator } from "./site-generator";
|
|
3
|
+
export { parseMarkdownDirectory } from "./parser";
|
|
4
|
+
export { startServer } from "./server";
|
|
5
|
+
export { DEFAULT_CONTENT_DIR, DEFAULT_OUTPUT_DIR, DEFAULT_TEMPLATES_DIR, DEFAULT_CONFIG_FILE, loadConfig, createDefaultConfig, configExists, saveConfig, } from "./config";
|
|
6
|
+
export { extractExcerpt, convertMarkdownToHtml, parseMarkdownFile, } from "./utils/markdown-utils";
|
|
7
|
+
export { findFilesByPattern, fileExists, readFileAsText, getBaseFilename, ensureDir, copyFile, } from "./utils/file-utils";
|
|
8
|
+
export { uploadImages, DEFAULT_IMAGES_DIR } from "./utils/image-uploader";
|
|
9
|
+
export { createUploader } from "./utils/s3-uploader";
|
package/dist/parser.d.ts
ADDED
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startServer(outputDir?: string, port?: number): Promise<Bun.Server>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GeneratorOptions } from "./types";
|
|
2
|
+
export declare class SiteGenerator {
|
|
3
|
+
private options;
|
|
4
|
+
private site;
|
|
5
|
+
private formatRSSDate;
|
|
6
|
+
private getPacificDate;
|
|
7
|
+
private createPagination;
|
|
8
|
+
constructor(options: GeneratorOptions);
|
|
9
|
+
initialize(): Promise<void>;
|
|
10
|
+
generate(): Promise<void>;
|
|
11
|
+
private generateYearArchives;
|
|
12
|
+
private generateIndexPage;
|
|
13
|
+
private generatePostPages;
|
|
14
|
+
private generateTagPages;
|
|
15
|
+
private generateStylesheet;
|
|
16
|
+
private fallbackCSSGeneration;
|
|
17
|
+
private copyStaticAssets;
|
|
18
|
+
private generateRSSFeed;
|
|
19
|
+
private generateSitemap;
|
|
20
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post object representing a single markdown file
|
|
3
|
+
*/
|
|
4
|
+
export interface Post {
|
|
5
|
+
/** Title of the post */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Date of the post in ISO format */
|
|
8
|
+
date: string;
|
|
9
|
+
/** Array of tags associated with the post */
|
|
10
|
+
tags: string[];
|
|
11
|
+
/** Map of tag names to their slugs */
|
|
12
|
+
tagSlugs: Record<string, string>;
|
|
13
|
+
/** Raw markdown content */
|
|
14
|
+
content: string;
|
|
15
|
+
/** Slug used in the URL */
|
|
16
|
+
slug: string;
|
|
17
|
+
/** URL path for this post */
|
|
18
|
+
url: string;
|
|
19
|
+
/** Brief excerpt from the post content */
|
|
20
|
+
excerpt: string;
|
|
21
|
+
/** Rendered HTML content */
|
|
22
|
+
html: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for CSS processing
|
|
26
|
+
*/
|
|
27
|
+
export interface CSSConfig {
|
|
28
|
+
/** Input CSS file path (relative to project root) */
|
|
29
|
+
input: string;
|
|
30
|
+
/** Output CSS file path (relative to output directory) */
|
|
31
|
+
output: string;
|
|
32
|
+
/** PostCSS config file path (relative to project root) */
|
|
33
|
+
postcssConfig?: string;
|
|
34
|
+
/** Whether to enable CSS processing */
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
/** Whether to watch for changes in development */
|
|
37
|
+
watch?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for the site
|
|
41
|
+
*/
|
|
42
|
+
export interface SiteConfig {
|
|
43
|
+
/** Site title */
|
|
44
|
+
title: string;
|
|
45
|
+
/** Site description */
|
|
46
|
+
description: string;
|
|
47
|
+
/** Base URL for the site (e.g., https://example.com) */
|
|
48
|
+
baseUrl: string;
|
|
49
|
+
/** Site identifier (used for metadata) */
|
|
50
|
+
domain: string;
|
|
51
|
+
/** Optional public URL for the bucket */
|
|
52
|
+
publicUrl?: string;
|
|
53
|
+
/** Optional S3 client configuration (accessKeyId, secretAccessKey, bucket, etc.) */
|
|
54
|
+
s3?: S3Config;
|
|
55
|
+
/** CSS processing configuration */
|
|
56
|
+
css?: CSSConfig;
|
|
57
|
+
/** Additional custom configuration options */
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Options for initializing the site generator
|
|
62
|
+
*/
|
|
63
|
+
export interface GeneratorOptions {
|
|
64
|
+
/** Directory containing markdown content */
|
|
65
|
+
contentDir: string;
|
|
66
|
+
/** Directory where generated files will be output */
|
|
67
|
+
outputDir: string;
|
|
68
|
+
/** Directory containing template files */
|
|
69
|
+
templatesDir: string;
|
|
70
|
+
/** Site configuration */
|
|
71
|
+
config: SiteConfig;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Data structure for tag information
|
|
75
|
+
*/
|
|
76
|
+
export interface TagData {
|
|
77
|
+
/** Name of the tag */
|
|
78
|
+
name: string;
|
|
79
|
+
/** URL-friendly slug version of the tag name */
|
|
80
|
+
slug: string;
|
|
81
|
+
/** Number of posts with this tag */
|
|
82
|
+
count: number;
|
|
83
|
+
/** Array of posts with this tag */
|
|
84
|
+
posts: Post[];
|
|
85
|
+
/** Optional description of the tag */
|
|
86
|
+
description?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Pagination information for archives and tag pages
|
|
90
|
+
*/
|
|
91
|
+
export interface PaginationData {
|
|
92
|
+
/** Current page number */
|
|
93
|
+
currentPage: number;
|
|
94
|
+
/** Total number of pages */
|
|
95
|
+
totalPages: number;
|
|
96
|
+
/** Whether there is a next page */
|
|
97
|
+
hasNextPage: boolean;
|
|
98
|
+
/** Whether there is a previous page */
|
|
99
|
+
hasPrevPage: boolean;
|
|
100
|
+
/** Next page number or null if no next page */
|
|
101
|
+
nextPage: number | null;
|
|
102
|
+
/** Previous page number or null if no previous page */
|
|
103
|
+
prevPage: number | null;
|
|
104
|
+
/** Number of items per page */
|
|
105
|
+
pageSize: number;
|
|
106
|
+
/** Total number of items across all pages */
|
|
107
|
+
totalItems: number;
|
|
108
|
+
/** Base path for pagination URLs */
|
|
109
|
+
pagePath: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Data structure for blog information
|
|
113
|
+
*/
|
|
114
|
+
export interface Site {
|
|
115
|
+
/** Site identifier */
|
|
116
|
+
name: string;
|
|
117
|
+
/** Array of posts for the site */
|
|
118
|
+
posts: Post[];
|
|
119
|
+
/** Map of tag names to tag data */
|
|
120
|
+
tags: Record<string, TagData>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Interface for uploaders (different services can implement this)
|
|
124
|
+
*/
|
|
125
|
+
export interface Uploader {
|
|
126
|
+
upload(sourcePath: string, config: SiteConfig): Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Interface for image uploaders
|
|
130
|
+
*/
|
|
131
|
+
export interface ImageUploader {
|
|
132
|
+
/**
|
|
133
|
+
* Upload all images from a directory
|
|
134
|
+
* @param imagesDir Directory containing images to upload
|
|
135
|
+
* @returns Record of image filenames to their public URLs
|
|
136
|
+
*/
|
|
137
|
+
uploadImages(imagesDir: string): Promise<Record<string, string>>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* S3 configuration type
|
|
141
|
+
*/
|
|
142
|
+
export interface S3Config {
|
|
143
|
+
accessKeyId: string;
|
|
144
|
+
secretAccessKey: string;
|
|
145
|
+
bucket: string;
|
|
146
|
+
publicUrl: string;
|
|
147
|
+
/** S3 client options */
|
|
148
|
+
endpoint?: string;
|
|
149
|
+
region?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Options for image upload
|
|
153
|
+
*/
|
|
154
|
+
export interface ImageUploadOptions {
|
|
155
|
+
domain?: string;
|
|
156
|
+
images?: string;
|
|
157
|
+
outputJson?: string;
|
|
158
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CSSConfig } from "../types";
|
|
2
|
+
export interface CSSProcessorOptions {
|
|
3
|
+
/** CSS configuration */
|
|
4
|
+
css: CSSConfig;
|
|
5
|
+
/** Project root directory */
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
/** Output directory for the site */
|
|
8
|
+
outputDir: string;
|
|
9
|
+
/** Whether to run in verbose mode */
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Process CSS using PostCSS
|
|
14
|
+
*/
|
|
15
|
+
export declare function processCSS(options: CSSProcessorOptions): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Watch CSS files for changes and reprocess
|
|
18
|
+
*/
|
|
19
|
+
export declare function watchCSS(options: CSSProcessorOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Get default CSS configuration
|
|
22
|
+
*/
|
|
23
|
+
export declare function getDefaultCSSConfig(): CSSConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Validate CSS configuration
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateCSSConfig(css: CSSConfig): string[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function findFilesByPattern(pattern: string, directory: string, absolute?: boolean): Promise<string[]>;
|
|
2
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
3
|
+
export declare function readFileAsText(filePath: string): Promise<string | null>;
|
|
4
|
+
export declare function getBaseFilename(filePath: string, extension?: string): string;
|
|
5
|
+
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
6
|
+
export declare function copyFile(sourcePath: string, targetPath: string): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Post } from "../types";
|
|
2
|
+
export declare function extractExcerpt(content: string, maxLength?: number): string;
|
|
3
|
+
export declare function convertMarkdownToHtml(markdownContent: string): string;
|
|
4
|
+
export declare function parseMarkdownFile(filePath: string): Promise<Post | null>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ImageUploader, S3Config, SiteConfig, Uploader } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Bun-native S3 uploader implementation
|
|
4
|
+
*/
|
|
5
|
+
export declare class S3Uploader implements Uploader, ImageUploader {
|
|
6
|
+
private s3Config;
|
|
7
|
+
private client;
|
|
8
|
+
constructor(s3Config: S3Config);
|
|
9
|
+
upload(sourcePath: string, config: SiteConfig): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Get the public URL for a file in S3
|
|
12
|
+
* @param s3Path Path to the file within the bucket
|
|
13
|
+
* @returns The public URL for the file
|
|
14
|
+
*/
|
|
15
|
+
private getPublicUrl;
|
|
16
|
+
uploadImages(imagesDir: string): Promise<Record<string, string>>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create an S3 uploader
|
|
20
|
+
* @param config The configuration for the uploader
|
|
21
|
+
* @returns An uploader instance
|
|
22
|
+
*/
|
|
23
|
+
export declare function createUploader(config: S3Config): Uploader & ImageUploader;
|
package/package.json
CHANGED