UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

101 lines 2.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Fs = void 0; const basefs_1 = require("./basefs"); const walkway_1 = require("../../../domain/fs/vo/walkway"); const static_copier_1 = require("../../../domain/fs/vo/static-copier"); const incremental_file_collector_1 = require("../../../domain/fs/vo/incremental-file-collector"); const fs_1 = require("../../../domain/fs"); /** * Fs entity - main filesystem entity * TypeScript version of Go's Fs struct */ class Fs { constructor(originFs, prompts, workflows, content, layouts, statics, assets, work) { this.originFs = originFs; this.prompts = prompts; this.workflows = workflows; this.content = content; this.layouts = layouts; this.statics = statics; this.assets = assets; this.work = work; this.service = (0, fs_1.newService)(); } /** * Get the OS filesystem */ os() { return this.originFs.getOrigin(); } /** * Get the work filesystem */ workFs() { return this.work; } workflowFs() { return this.workflows; } promptFs() { return this.prompts; } contentFs() { return this.content; } layoutsFs() { return this.layouts; } staticFs() { return this.statics; } assetsFs() { return this.assets; } publishFs() { return this.originFs.publish(); } copyStatic(froms, to) { const sc = new static_copier_1.StaticCopier(froms, to); return sc.copy(); } newFileMetaInfo(filename) { return this.service.newFileMetaInfo(filename); } newFileMetaInfoWithContent(content) { return this.service.newFileMetaInfoWithContent(content); } async getFileMetaInfos(paths) { return (0, incremental_file_collector_1.collectFileMetaInfos)(paths, this.content); } /** * Create new base path filesystem */ newBasePathFs(source, path) { return (0, basefs_1.newBaseFs)(source, [path]); } async walkPrompts(start, cb, conf) { return await this.walk(this.prompts, start, cb, conf); } async walkWorkflows(start, cb, conf) { return await this.walk(this.workflows, start, cb, conf); } async walkLayouts(start, cb, conf) { return await this.walk(this.layouts, start, cb, conf); } async walkContent(start, cb, conf) { return await this.walk(this.content, start, cb, conf); } async walkStatics(start, cb, conf) { return await this.walk(this.statics, start, cb, conf); } async walk(fs, start, cb, conf) { const w = (0, walkway_1.newWalkway)(fs, cb); if (start === '') { start = '/'; } return await w.walkWith(start, conf); } } exports.Fs = Fs; //# sourceMappingURL=fs.js.map