You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
2.8 KiB

import { BlockData } from './data.d';
export interface IFindJSOpts {
base: string;
fileNameWithoutExt?: string;
}
export declare const findJS: (opts: any) => string;
/**
* Get the fast registry Url(github.com or gitee.com)
*/
export declare const getFastGithub: () => Promise<string>;
/**
* * 预览专用 *
* 从文件数组映射为 pro 的路由
* @param {*} name
*/
export declare const genBlockName: (name: any) => any;
/**
* 将区块转化为 inquirer 能用的数组
* @param {*} blocks
* @returns {[
* name:string;
* value:string;
* key:string;
* ]} blockArray
*/
export declare function printBlocks(blocks: any, hasLink?: any): any[];
export declare const imgFilter: (list: any, { name, owner }: {
name: any;
owner: any;
}, useGitee: any) => any;
export declare const getBlockListFromGit: (gitUrl: any, useBuiltJSON?: any) => Promise<any>;
/**
* clone 下来的 git 会缓存。这个方法可以更新缓存
* @param {*} ctx
* @param {*} mySpinner
*/
export declare function gitUpdate(ctx: any, mySpinner: any): Promise<void>;
/**
* 打平 children
* {
* path:"/user",
* children:[{ path: "/user/list" }]
* }
* --->
* /user /user/list
* @param treeData
*/
export declare const reduceData: (treeData: any) => any;
/**
* 克隆区块的地址
* @param {*} ctx
* @param {*} mySpinner
*/
export declare function gitClone(ctx: any, mySpinner: any): Promise<void>;
/**
* 删除重复的下划线什么的
* @param path
*/
export declare const removePrefix: (path: any) => any;
/**
* 增加路由前缀
* data -> /data
* @param path
* @param parentPath
*/
export declare const addRoutePrefix: (path?: string, parentPath?: string) => any;
export declare const genRouterToTreeData: (routes: any, path?: string) => any;
/**
* 根据 router 来获取 component
* 用于区块的插入
* @param {*} routes
*/
export declare const genComponentToTreeData: (routes: any, path?: string) => any;
/**
* 判断路由是否存在
* @param {*} path string
* @param {*} routes
*/
export declare function routeExists(path: any, routes?: any[]): boolean;
/**
* 获取路由的数据
* @param {*} routes
*/
export declare const depthRouterConfig: (routerConfig: any) => import("./arrayToTree").TreeItem[];
export interface TreeData {
title: string;
value: string;
key: string;
children?: TreeData[];
}
/**
* get BlockList from blockList.json in github repo
*/
export declare const fetchBlockList: (repo: string) => Promise<BlockData>;
/**
* 通过 npm CDN url 获取区块数据
* @param pkg 包名
*/
export declare function fetchCDNBlocks({ pkg, summary, version, factor, }: {
pkg: any;
summary?: string;
version?: string;
factor: any;
}): Promise<{
data: any;
success: boolean;
message?: undefined;
} | {
message: any;
data: any;
success: boolean;
}>;