UNPKG

@baseplate-dev/core-generators

Version:

Core generators for Baseplate

36 lines 2.14 kB
import type { TemplateFileOptions } from '#src/renderers/schemas/template-file-options.js'; export interface TemplatePathRoot { canonicalPath: string; pathRootName: string; } declare function getPathsRootExportName(generatorName: string): string; export declare const TEMPLATE_PATHS_METADATA_FILE = ".paths-metadata.json"; /** * The template paths plugin is used to enable templates to get assigned a path * relative to their nearest path root, e.g. the feature folder or package root. * * To support such behavior, it is necessary to use the path-metadata generator * which writes a .paths-metadata.json to the output directory. */ export declare const templatePathsPlugin: import("@baseplate-dev/sync").TemplateExtractorPlugin<"template-paths", { getPathRootRelativePath: (absolutePath: string) => string; getTemplatePathFromPathRootRelativePath: typeof getTemplatePathFromPathRootRelativePath; registerTemplatePathEntry: (generatorName: string, templateName: string, pathRootRelativePath: string) => void; resolveTemplatePaths: (fileOptions: TemplateFileOptions, absolutePath: string, templateName: string, generatorName: string) => { pathRootRelativePath: string | undefined; generatorTemplatePath: string; }; getPathsRootExportName: typeof getPathsRootExportName; }, import("@baseplate-dev/sync").TemplateExtractorPlugin<"barrel-export", { addBarrelExport: (generatorName: string, barrelExport: import("../barrel-export.js").TemplateExtractorBarrelExport) => void; addGeneratedBarrelExport: (generatorName: string, generatedBarrelExport: import("../barrel-export.js").TemplateExtractorGeneratedBarrelExport) => void; }, []>[]>; /** * Gets the template path from a path root relative path by stripping the brackets and -root from the path. * * @param pathRootRelativePath - The path root relative path. (e.g. `{feature-root}/services/test.ts`) * @returns The template path. (e.g. `feature/services/[file].ts`) */ declare function getTemplatePathFromPathRootRelativePath(pathRootRelativePath: string): string; export {}; //# sourceMappingURL=template-paths.plugin.d.ts.map