UNPKG

@mdfriday/foundry

Version:

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

79 lines 2.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PATH_CONSTANTS = exports.PathValidationError = exports.PathParseError = exports.PathError = exports.PathType = void 0; /** * PathType enum represents different types of paths */ var PathType; (function (PathType) { /** A generic resource, e.g. a JSON file */ PathType[PathType["File"] = 0] = "File"; /** A resource of a content type with front matter */ PathType[PathType["ContentResource"] = 1] = "ContentResource"; /** E.g. /blog/my-post.md */ PathType[PathType["ContentSingle"] = 2] = "ContentSingle"; /** Leaf bundles, e.g. /blog/my-post/index.md */ PathType[PathType["Leaf"] = 3] = "Leaf"; /** Branch bundles, e.g. /blog/_index.md */ PathType[PathType["Branch"] = 4] = "Branch"; })(PathType || (exports.PathType = PathType = {})); /** * Error types for path processing */ class PathError extends Error { constructor(message, path) { super(message); this.path = path; this.name = 'PathError'; } } exports.PathError = PathError; class PathParseError extends PathError { constructor(message, path) { super(message, path); this.name = 'PathParseError'; } } exports.PathParseError = PathParseError; class PathValidationError extends PathError { constructor(message, path, validationErrors) { super(message, path); this.validationErrors = validationErrors; this.name = 'PathValidationError'; } } exports.PathValidationError = PathValidationError; /** * Constants for common file extensions and patterns */ exports.PATH_CONSTANTS = { CONTENT_EXTENSIONS: ['.md', '.markdown', '.mdown', '.mkd', '.mkdn', '.html', '.htm', '.xml'], HTML_EXTENSIONS: ['.html', '.htm'], INDEX_NAMES: ['index', '_index'], PATH_SEPARATOR: '/', EXTENSION_SEPARATOR: '.', LANGUAGE_SEPARATOR: '.', // System-specific path separator detection SYSTEM_PATH_SEPARATOR: (() => { try { return require('path').sep; } catch { return '/'; // Default to Unix separator if not in Node.js environment } })(), // Component folder constants - matching golang files/classifier.go COMPONENT_FOLDER_CONTENT: 'content', COMPONENT_FOLDER_STATIC: 'static', COMPONENT_FOLDER_LAYOUTS: 'layouts', COMPONENT_FOLDER_ARCHETYPES: 'archetypes', COMPONENT_FOLDER_DATA: 'data', COMPONENT_FOLDER_ASSETS: 'assets', COMPONENT_FOLDER_I18N: 'i18n', // Path normalization utility normalizePath: (path) => { // Convert all backslashes to forward slashes for consistent processing return path.replace(/\\/g, '/'); } }; //# sourceMappingURL=type.js.map