UNPKG

2.66 kBTypeScriptView Raw
1import moment from 'moment';
2import type default_config from './hexo/default_config';
3export type NodeJSLikeCallback<R, E = any> = (err: E, result?: R) => void;
4export interface RenderData {
5 engine?: string;
6 content?: string;
7 disableNunjucks?: boolean;
8 markdown?: object;
9 source?: string;
10 titlecase?: boolean;
11 title?: string;
12 excerpt?: string;
13 more?: string;
14}
15export interface PostSchema {
16 id?: string;
17 _id?: string;
18 title?: string;
19 date?: moment.Moment;
20 updated?: moment.Moment;
21 comments?: boolean;
22 layout?: string;
23 _content?: string;
24 source?: string;
25 slug?: string;
26 photos?: string[];
27 raw?: string;
28 published?: boolean;
29 content?: string;
30 excerpt?: string;
31 more?: string;
32 author?: string;
33 asset_dir?: string;
34 full_source?: string;
35 path?: string;
36 permalink?: string;
37 categories?: any;
38 tags?: any;
39 __permalink?: string;
40 __post?: boolean;
41 canonical_path?: string;
42 lang?: string;
43 language?: string;
44 prev?: PostSchema;
45 next?: PostSchema;
46}
47export interface PageSchema {
48 _id?: string;
49 title?: string;
50 date?: moment.Moment;
51 updated?: moment.Moment;
52 comments?: boolean;
53 layout?: string;
54 _content?: string;
55 source?: string;
56 path?: string;
57 raw?: string;
58 content?: string;
59 excerpt?: string;
60 more?: string;
61 author?: string;
62 full_source?: string;
63 permalink?: string;
64 tags?: any;
65 canonical_path?: string;
66 lang?: string;
67 language?: string;
68 __page?: boolean;
69}
70export interface LocalsType {
71 page: PostSchema | PageSchema;
72 path: string;
73 url: string;
74 config: typeof default_config;
75 theme: object;
76 layout: string;
77 env: any;
78 view_dir: string;
79 site: object;
80 cache?: boolean;
81 __?: (key: string) => string;
82 _p?: (key: string, options?: any) => string;
83}
84export interface AssetGenerator {
85 path: string;
86 data: {
87 modified: boolean;
88 data?: () => any;
89 };
90}
91export type SimplePostGenerator = {
92 path: string;
93 data: string;
94};
95export type NormalPostGenerator = {
96 path: string;
97 layout: string[];
98 data: PostSchema;
99};
100export type PostGenerator = SimplePostGenerator | NormalPostGenerator;
101export type SimplePageGenerator = {
102 path: string;
103 data: string;
104};
105export type NormalPageGenerator = {
106 path: string;
107 layout: string[];
108 data: PageSchema;
109};
110export type PageGenerator = SimplePageGenerator | NormalPageGenerator;
111export interface SiteLocals {
112 posts: any;
113 pages: any;
114 categories: any;
115 tags: any;
116 data: object;
117}