Refactoring
This commit is contained in:
parent
1e3833f7d0
commit
aa563e60ea
37 changed files with 472 additions and 2392 deletions
4
types/config.d.ts
vendored
4
types/config.d.ts
vendored
|
@ -1,7 +1,7 @@
|
|||
export default class ProjectConfig {
|
||||
config: any;
|
||||
private __filename;
|
||||
private __dirname;
|
||||
constructor();
|
||||
load(): void;
|
||||
getConfig(): any;
|
||||
read(): any;
|
||||
}
|
||||
|
|
2
types/context.d.ts
vendored
Normal file
2
types/context.d.ts
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export default interface Context {
|
||||
}
|
11
types/markdown.d.ts
vendored
11
types/markdown.d.ts
vendored
|
@ -1,7 +1,6 @@
|
|||
export declare function parseMD(file: string): {
|
||||
meta: {
|
||||
[key: string]: any;
|
||||
};
|
||||
content: string | Promise<string>;
|
||||
};
|
||||
import Parser, { File } from "./renderer.js";
|
||||
export default class Markdown implements Parser {
|
||||
name: string;
|
||||
loadAsHTML(filePath: string): File;
|
||||
}
|
||||
export declare function parseMarkdown(obj: any): void;
|
||||
|
|
12
types/page.d.ts
vendored
Normal file
12
types/page.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
import Renderer, { File } from "./renderer.js";
|
||||
export default class Page {
|
||||
file: File;
|
||||
dir: string[];
|
||||
path: string;
|
||||
finalPath: string;
|
||||
fileName: string;
|
||||
hidden: boolean;
|
||||
title: string;
|
||||
layout: string;
|
||||
constructor(filePath: string, renderer: Renderer);
|
||||
}
|
10
types/parser.d.ts
vendored
Normal file
10
types/parser.d.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
export interface File {
|
||||
get html(): string;
|
||||
get data(): {
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
export default interface Parser {
|
||||
get name(): string;
|
||||
parse(path: string): File;
|
||||
}
|
12
types/project.d.ts
vendored
12
types/project.d.ts
vendored
|
@ -1,11 +1,11 @@
|
|||
import ProjectConfig from './project-config.js';
|
||||
import Page from './page.js';
|
||||
export default class Project {
|
||||
config: ProjectConfig;
|
||||
private __filename;
|
||||
private __dirname;
|
||||
private DEFAULT_PROJECT_PATH;
|
||||
private config;
|
||||
pages: Page[];
|
||||
constructor();
|
||||
new(): void;
|
||||
existing(): void;
|
||||
build(): void;
|
||||
loadPages(): Page[];
|
||||
compile(page: Page): void;
|
||||
context(page: Page): any;
|
||||
}
|
||||
|
|
10
types/renderer.d.ts
vendored
Normal file
10
types/renderer.d.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
export interface File {
|
||||
get html(): string;
|
||||
get data(): {
|
||||
[key: string]: any;
|
||||
};
|
||||
}
|
||||
export default interface Renderer {
|
||||
get name(): string;
|
||||
loadAsHTML(path: string): File;
|
||||
}
|
9
types/utils.d.ts
vendored
9
types/utils.d.ts
vendored
|
@ -1,4 +1,11 @@
|
|||
export declare function parseYML(file: string): unknown;
|
||||
export declare function getAllFilesWithExtension(directory: string, extension: string, excludes: string[]): string[];
|
||||
export declare function cp(source: string, destination: string): void;
|
||||
declare function removeDirectorySync(directory: string): void;
|
||||
export declare function pathToArray(filePath: string): string[];
|
||||
declare const _default: {
|
||||
pathToArray: typeof pathToArray;
|
||||
cp: typeof cp;
|
||||
getAllFilesWithExtension: typeof getAllFilesWithExtension;
|
||||
removeDirectorySync: typeof removeDirectorySync;
|
||||
};
|
||||
export default _default;
|
||||
|
|
5
types/yaml.d.ts
vendored
Normal file
5
types/yaml.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Renderer, { File } from "./renderer.js";
|
||||
export default class Yaml implements Renderer {
|
||||
name: string;
|
||||
loadAsHTML(file: string): File;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue