UNPKG

wx-to-tt

Version:

transform wx micro app to bytedance micro app

53 lines (52 loc) 1.9 kB
import vfile from 'vfile'; import { Parser, DomHandler } from 'stricter-htmlparser2'; import { TT_SUFFIX_ENUM } from './constant'; import { TTContext } from '..'; export declare const isDirValid: (path: string) => boolean; export declare type ParserOptions = { xmlMode: boolean; lowerCaseAttributeNames: boolean; recognizeSelfClosing: boolean; lowerCaseTags: boolean; }; export declare const getHtmlParser: (options: ParserOptions) => { htmlParser: Parser; handler: DomHandler; }; /** * * @param {object} config 配置文件 * @param {string} suffix 文件名后缀 * @returns */ export declare const traverseFiles: (config: TTContext, suffix: TT_SUFFIX_ENUM | 'js' | 'json') => Promise<string[]>; /** * 拷贝项目 * * @param {string} fromPath 目标目录路径 * @param {string} toPath 生成目录路径 * @return {Promise} */ export declare const copyProject: (fromPath: string, toPath: string) => Promise<any[]> | Promise<void>; /** * 判断路径是否为目录 * * @param {string} entryPath 路径 * @return {boolean} */ export declare function isDirectory(entryPath: string): boolean; export declare const getContent: (filepath: string) => Promise<string>; export declare const getJSONContent: (filepath: string) => Promise<Record<string, unknown>>; export declare const getContentSync: (filepath: string) => string; export declare const saveFile: (path: string, con: string) => Promise<boolean>; export declare const saveLog: (logPath: string, con: string) => Promise<unknown>; /** * 创建虚拟文件,并添加关联文件 * * @param {string} filePath 文件路径 * @param {string} contents 文件内容 * @return {VFile} */ export declare const toVFile: (filePath: string, contents: string) => vfile.VFile; export declare const getDefaultDest: (dist: string) => string; export declare const auditCode: (ctx: TTContext) => Promise<void>;