This commit is contained in:
eibons
2025-08-15 21:37:29 +08:00
parent 2d7f77a984
commit ce999372ae
183 changed files with 21567 additions and 5 deletions

View File

@@ -0,0 +1,2 @@
import type { Plugin } from "vite";
export declare function base(): Plugin;

View File

@@ -0,0 +1,34 @@
import type { Type } from "../types";
export declare const config: {
type: Type;
reqUrl: string;
demo: boolean;
nameTag: boolean;
eps: {
enable: boolean;
api: string;
dist: string;
mapping: ({
custom: ({ propertyName, type }: {
propertyName: string;
type: string;
}) => null;
type?: undefined;
test?: undefined;
} | {
type: string;
test: string[];
custom?: undefined;
})[];
};
svg: {
skipNames: string[];
};
tailwind: {
enable: boolean;
remUnit: number;
remPrecision: number;
rpxRatio: number;
darkTextClass: string;
};
};

View File

@@ -0,0 +1,2 @@
import type { Ctx } from "../../types";
export declare function createCtx(): Promise<Ctx.Data>;

View File

@@ -0,0 +1,2 @@
import type { Plugin } from "vite";
export declare function demo(enable?: boolean): Plugin;

View File

@@ -0,0 +1,7 @@
/**
* 将模板字符串扁平化处理,转换为 Service 类型定义
* @param template - 包含 Service 类型定义的模板字符串
* @returns 处理后的 Service 类型定义字符串
* @throws {Error} 当模板中找不到 Service 类型定义时抛出错误
*/
export declare function flatten(template: string): string;

View File

@@ -0,0 +1,18 @@
import type { Eps } from "../../types";
/**
* 主入口:创建 eps 相关文件和 service
*/
export declare function createEps(): Promise<{
service: {};
serviceCode: {
content: string;
types: string[];
};
list: Eps.Entity[];
isUpdate: boolean;
} | {
service: {};
list: never[];
serviceCode?: undefined;
isUpdate?: undefined;
}>;

View File

@@ -0,0 +1,6 @@
interface Item {
path: string;
code: string;
}
export declare function createFile(data: Item | Item[]): Promise<void>;
export {};

View File

@@ -0,0 +1,2 @@
import type { Config } from "../types";
export declare function cool(options: Config.Options): (import("vite").Plugin<any> | Promise<import("vite").Plugin<any>> | Promise<import("vite").Plugin<any>[]>)[];

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
export declare function updateProxy(data: {
name: string;
}): Promise<void>;
export declare function getProxyTarget(proxy: any): any;

View File

@@ -0,0 +1,4 @@
export declare function createSvg(): Promise<{
code: string;
svgIcons: string[];
}>;

View File

@@ -0,0 +1,4 @@
export declare function createTag(code: string, id: string): {
map: any;
code: any;
} | null;

View File

@@ -0,0 +1 @@
export declare function test(): void;

View File

@@ -0,0 +1,67 @@
interface PostcssRemToRpxOptions {
remUnit?: number;
remPrecision?: number;
rpxRatio?: number;
}
interface TailwindTransformOptions extends PostcssRemToRpxOptions {
}
/**
* Vite 插件:自动转换 .uvue 文件中的 Tailwind 类名为安全字符
* 并自动注入 rem 转 rpx 的 PostCSS 插件
* @param options 配置项
* @returns Vite 插件对象
*/
export declare function tailwindTransformPlugin(options?: TailwindTransformOptions): {
name: string;
enforce: "pre";
config(): {
css: {
postcss: {
plugins: {
postcssPlugin: string;
prepare(): {
Rule(rule: any): void;
Declaration(decl: any): void;
};
}[];
};
};
};
transform(code: string, id: string): {
code: string;
map: {
mappings: string;
};
} | null;
};
/**
* uniappX 入口,自动注入 Tailwind 类名转换插件
* @param options 配置项
* @returns Vite 插件数组
*/
export declare function uniappX(options?: {
tailwind?: TailwindTransformOptions;
}): {
name: string;
enforce: "pre";
config(): {
css: {
postcss: {
plugins: {
postcssPlugin: string;
prepare(): {
Rule(rule: any): void;
Declaration(decl: any): void;
};
}[];
};
};
};
transform(code: string, id: string): {
code: string;
map: {
mappings: string;
};
} | null;
}[];
export {};

View File

@@ -0,0 +1,2 @@
import type { Plugin } from "vite";
export declare function codePlugin(): Plugin[];

View File

@@ -0,0 +1,9 @@
type primaryColor = "emerald" | "green" | "lime" | "orange" | "amber" | "yellow" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink";
type surfaceColor = "slate" | "gray" | "zinc" | "neutral" | "stone" | "soho" | "viva" | "ocean";
export declare function colorPalette(options: {
primary: primaryColor;
surface: surfaceColor;
}): {
[x: string]: string;
};
export {};

View File

@@ -0,0 +1,8 @@
/**
* 特殊字符映射表
*/
export declare const SAFE_CHAR_MAP: Record<string, string>;
/**
* 特殊字符映射表(国际化)
*/
export declare const SAFE_CHAR_MAP_LOCALE: Record<string, string>;

View File

@@ -0,0 +1,7 @@
/**
* 将模板字符串扁平化处理,转换为 Service 类型定义
* @param template - 包含 Service 类型定义的模板字符串
* @returns 处理后的 Service 类型定义字符串
* @throws {Error} 当模板中找不到 Service 类型定义时抛出错误
*/
export declare function flatten(template: string): string;

View File

@@ -0,0 +1,7 @@
import type { Plugin } from "vite";
/**
* uniappX 入口,自动注入 Tailwind 类名转换插件
* @param options 配置项
* @returns Vite 插件数组
*/
export declare function uniappX(): Promise<Plugin<any>[]>;

View File

@@ -0,0 +1,9 @@
import type { Plugin } from "vite";
/**
* 转换类名中的特殊字符为安全字符
*/
export declare function toSafeClass(className: string): string;
/**
* Tailwind 类名转换插件
*/
export declare function tailwindPlugin(): Plugin<any>[];

View File

@@ -0,0 +1,28 @@
/**
* 获取动态类名
*/
export declare const getDynamicClassNames: (value: string) => string[];
/**
* 获取类名
*/
export declare function getClassNames(code: string): string[];
/**
* 获取 class 内容
*/
export declare function getClassContent(code: string): string[];
/**
* 获取节点
*/
export declare function getNodes(code: string): string[];
/**
* 添加 script 标签内容
*/
export declare function addScriptContent(code: string, content: string): string;
/**
* 判断是否为 Tailwind 类名
*/
export declare function isTailwindClass(className: string): boolean;
/**
* 将 interface 转换为 type
*/
export declare function interfaceToType(code: string): string;

View File

@@ -0,0 +1,11 @@
import prettier from "prettier";
export declare function rootDir(path: string): string;
export declare function firstUpperCase(value: string): string;
export declare function toCamel(str: string): string;
export declare function createDir(path: string, recursive?: boolean): void;
export declare function readFile(path: string, json?: boolean): any;
export declare function writeFile(path: string, data: any): void | "";
export declare function parseJson(req: any): Promise<any>;
export declare function formatContent(content: string, options?: prettier.Options): Promise<string>;
export declare function error(message: string): void;
export declare function success(message: string): void;

View File

@@ -0,0 +1,2 @@
import type { Plugin } from "vite";
export declare function virtual(): Promise<Plugin>;