@lonu/stc
Version:
A tool for converting OpenApi/Swagger/Apifox into code.
48 lines • 1.96 kB
TypeScript
import { Eta } from "../../deps/jsr.io/@eta-dev/eta/3.5.0/src/index.js";
import type { IPluginOptions, IPluginSetup } from "./typeDeclaration.js";
/**
* Sets up the template engine with the provided options.
*
* @param {IPluginOptions} options - The plugin options to use for setting up the template.
* @param {object} [template] - The template options.
* @return {Eta} The set up template instance.
*/
export declare const setupTemplate: (options: IPluginOptions, template?: {
/**
* 语言插件目录名称
* @default `options.lang`
*/
langDirectoryName?: string;
/**
* 模板文件路径
* @default `./src/plugins/{{langDirectoryName}}/template`
*/
path?: string;
}) => Eta;
/**
* Renders a template based on the provided name and data.
*
* @param {string} name - The name of the template to render.
* @param {Record<string, unknown>} data - The data to be used in the template.
* @return {string} The rendered template as a string.
*/
export declare const renderTemplate: (name: string, data: Record<string, unknown>) => string;
/**
* Render a template with Eta.
*
* @param content - A string of template.
* @param data - A object contains data.
* @returns A rendered string.
*/
export declare const renderEtaString: (content: string, data: Record<string, unknown>) => string;
/**
* Converts a given type to a string representation, taking into account the provided reference and plugin setup.
*
* @param {string|string[]} type - The type to be converted.
* @param {string} [ref] - The reference type.
* @param {pluginSetup | IPluginOptions} [pluginSetup] - The plugin setup.
* @return {string} The converted type as a string.
*/
export declare const convertType: (type: string | string[], ref?: string, pluginSetup?: IPluginSetup | IPluginOptions) => string;
export declare const validTemplate: (template: IPluginOptions["template"]) => void;
//# sourceMappingURL=common.d.ts.map