bunki 0.21.0 → 0.22.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.
package/dist/config.d.ts CHANGED
@@ -1,11 +1,22 @@
1
1
  import type { SiteConfig } from "./types";
2
+ type ConfigLike = Partial<SiteConfig>;
3
+ export type ProjectPaths = {
4
+ rootDir: string;
5
+ contentDir: string;
6
+ outputDir: string;
7
+ templatesDir: string;
8
+ configFile: string;
9
+ };
10
+ export declare function createProjectPaths(rootDir?: string): ProjectPaths;
2
11
  export declare const DEFAULT_CONTENT_DIR: string;
3
12
  export declare const DEFAULT_OUTPUT_DIR: string;
4
13
  export declare const DEFAULT_TEMPLATES_DIR: string;
5
14
  export declare const DEFAULT_CONFIG_TS: string;
6
15
  export declare const DEFAULT_CONFIG_FILE: string;
16
+ export declare function defineConfig<T extends ConfigLike | (() => ConfigLike | Promise<ConfigLike>)>(config: T): T;
7
17
  export declare function configExists(configPath?: string): Promise<boolean>;
8
- export declare function loadConfig(configPath?: string): Promise<SiteConfig>;
18
+ export declare function loadConfig(configPath?: string, projectRoot?: string): Promise<SiteConfig>;
9
19
  export declare function getDefaultConfig(): SiteConfig;
10
20
  export declare function createDefaultConfig(configPath?: string): Promise<boolean>;
11
21
  export declare function saveConfig(config: SiteConfig, configPath?: string): Promise<boolean>;
22
+ export {};
@@ -30,6 +30,8 @@ export declare const FILES: {
30
30
  export declare const SEO: {
31
31
  /** Add noindex meta tag to pagination pages beyond this number */
32
32
  readonly NOINDEX_AFTER_PAGE: 2;
33
+ /** Tag pages with this many posts or fewer are noindexed (see tag.njk) and excluded from the sitemap */
34
+ readonly THIN_TAG_MAX_POSTS: 2;
33
35
  };
34
36
  /**
35
37
  * Cache and time-based constants
@@ -3,14 +3,14 @@
3
3
  */
4
4
  import type { SiteConfig } from "../types";
5
5
  /**
6
- * Generate stylesheet using PostCSS or fallback to direct copy
6
+ * Generate stylesheet using Bun or PostCSS, with fallback to direct copy
7
7
  * @param config - Site configuration
8
8
  * @param outputDir - Output directory
9
9
  */
10
- export declare function generateStylesheet(config: SiteConfig, outputDir: string): Promise<void>;
10
+ export declare function generateStylesheet(config: SiteConfig, outputDir: string, projectRoot?: string): Promise<void>;
11
11
  /**
12
12
  * Copy static assets from templates/assets and public/ directories
13
13
  * @param templatesDir - Templates directory
14
14
  * @param outputDir - Output directory
15
15
  */
16
- export declare function copyStaticAssets(templatesDir: string, outputDir: string): Promise<void>;
16
+ export declare function copyStaticAssets(templatesDir: string, outputDir: string, projectRoot?: string): Promise<void>;
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Page generation logic
3
3
  */
4
- import type { Site, SiteConfig } from "../types";
4
+ import type { Site, SiteConfig, TemplateObject } from "../types";
5
+ interface PageRenderer {
6
+ render(name: string, context: TemplateObject): string;
7
+ }
5
8
  /**
6
9
  * Generate homepage with pagination
7
10
  * @param site - Site data
@@ -9,14 +12,14 @@ import type { Site, SiteConfig } from "../types";
9
12
  * @param outputDir - Output directory
10
13
  * @param pageSize - Items per page
11
14
  */
12
- export declare function generateIndexPages(site: Site, config: SiteConfig, outputDir: string, pageSize?: number): Promise<void>;
15
+ export declare function generateIndexPages(site: Site, config: SiteConfig, outputDir: string, pageSize?: number, renderer?: PageRenderer): Promise<void>;
13
16
  /**
14
17
  * Generate individual post pages
15
18
  * @param site - Site data
16
19
  * @param config - Site configuration
17
20
  * @param outputDir - Output directory
18
21
  */
19
- export declare function generatePostPages(site: Site, config: SiteConfig, outputDir: string): Promise<void>;
22
+ export declare function generatePostPages(site: Site, config: SiteConfig, outputDir: string, renderer?: PageRenderer): Promise<void>;
20
23
  /**
21
24
  * Generate tag pages with pagination
22
25
  * @param site - Site data
@@ -24,7 +27,7 @@ export declare function generatePostPages(site: Site, config: SiteConfig, output
24
27
  * @param outputDir - Output directory
25
28
  * @param pageSize - Items per page
26
29
  */
27
- export declare function generateTagPages(site: Site, config: SiteConfig, outputDir: string, pageSize?: number): Promise<void>;
30
+ export declare function generateTagPages(site: Site, config: SiteConfig, outputDir: string, pageSize?: number, renderer?: PageRenderer): Promise<void>;
28
31
  /**
29
32
  * Generate year archive pages with pagination
30
33
  * @param site - Site data
@@ -32,23 +35,24 @@ export declare function generateTagPages(site: Site, config: SiteConfig, outputD
32
35
  * @param outputDir - Output directory
33
36
  * @param pageSize - Items per page
34
37
  */
35
- export declare function generateYearArchives(site: Site, config: SiteConfig, outputDir: string, pageSize?: number): Promise<void>;
38
+ export declare function generateYearArchives(site: Site, config: SiteConfig, outputDir: string, pageSize?: number, renderer?: PageRenderer): Promise<void>;
36
39
  /**
37
40
  * Generate 404 error page (optional)
38
41
  * @param config - Site configuration
39
42
  * @param outputDir - Output directory
40
43
  */
41
- export declare function generate404Page(config: SiteConfig, outputDir: string): Promise<void>;
44
+ export declare function generate404Page(config: SiteConfig, outputDir: string, renderer?: PageRenderer): Promise<void>;
42
45
  /**
43
46
  * Generate map page (optional)
44
47
  * @param site - Site data
45
48
  * @param config - Site configuration
46
49
  * @param outputDir - Output directory
47
50
  */
48
- export declare function generateMapPage(site: Site, config: SiteConfig, outputDir: string): Promise<void>;
51
+ export declare function generateMapPage(site: Site, config: SiteConfig, outputDir: string, renderer?: PageRenderer): Promise<void>;
49
52
  /**
50
53
  * Generate privacy policy page (optional)
51
54
  * @param config - Site configuration
52
55
  * @param outputDir - Output directory
53
56
  */
54
- export declare function generatePrivacyPage(config: SiteConfig, outputDir: string): Promise<void>;
57
+ export declare function generatePrivacyPage(config: SiteConfig, outputDir: string, renderer?: PageRenderer): Promise<void>;
58
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- export { configExists, createDefaultConfig, DEFAULT_CONFIG_FILE, DEFAULT_CONTENT_DIR, DEFAULT_OUTPUT_DIR, DEFAULT_TEMPLATES_DIR, loadConfig, saveConfig, } from "./config";
1
+ export { configExists, createDefaultConfig, createProjectPaths, DEFAULT_CONFIG_FILE, DEFAULT_CONTENT_DIR, DEFAULT_OUTPUT_DIR, DEFAULT_TEMPLATES_DIR, defineConfig, loadConfig, saveConfig, } from "./config";
2
2
  export { CACHE, DATE, FILES, PAGINATION, SEO } from "./constants";
3
3
  export { parseMarkdownDirectory } from "./parser";
4
4
  export { startServer } from "./server";
5
5
  export { SiteGenerator } from "./site-generator";
6
+ export { createSiteModel, groupPostsByYear } from "./site-model";
6
7
  export * from "./types";
7
8
  export { copyFile, ensureDir, fileExists, findFilesByPattern, getBaseFilename, readFileAsText, } from "./utils/file-utils";
8
9
  export { DEFAULT_IMAGES_DIR, uploadImages } from "./utils/image-uploader";
9
- export { convertMarkdownToHtml, extractExcerpt, parseMarkdownFile, } from "./utils/markdown-utils";
10
+ export { convertMarkdownToHtml, extractExcerpt, parseMarkdownFile } from "./utils/markdown-utils";
10
11
  export { createUploader } from "./utils/s3-uploader";
11
- export { generateCollectionSchemas, generateHomeBreadcrumbs, } from "./utils/schema-factory";
12
+ export { generateCollectionSchemas, generateHomeBreadcrumbs } from "./utils/schema-factory";
12
13
  export { createTemplateEngine } from "./utils/template-engine";