easyutilssdk 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * 版本信息
3
3
  * realBranch(真实分支): dev
4
- * buildTime(打包时间): 2025/12/30 17:02:35
5
- * commitId(最后一条提交SHA): c774ff55af1a47a8b14369f4a6f3a781e1bd4245
4
+ * buildTime(打包时间): 2025/12/30 17:39:54
5
+ * commitId(最后一条提交SHA): 2b6ad68b56500149f5c24a2bc03a5d5f9688b47b
6
6
  */
7
7
 
8
8
  /*
package/dist/web/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * 版本信息
3
3
  * realBranch(真实分支): dev
4
- * buildTime(打包时间): 2025/12/30 17:02:31
5
- * commitId(最后一条提交SHA): c774ff55af1a47a8b14369f4a6f3a781e1bd4245
4
+ * buildTime(打包时间): 2025/12/30 17:39:49
5
+ * commitId(最后一条提交SHA): 2b6ad68b56500149f5c24a2bc03a5d5f9688b47b
6
6
  */
7
7
 
8
8
  /*
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "easyutilssdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "main": "dist/node/index.js",
5
5
  "browser": "dist/web/index.js",
6
6
  "author": "liuyk",
7
+ "types": "dist/types/node/index.d.ts",
7
8
  "license": "MIT",
8
9
  "scripts": {
9
10
  "prepublishOnly": "npm run build",
11
+ "build:declarations": "tsc --emitDeclarationOnly",
10
12
  "build:web": "webpack --config webpack.web.config.js",
11
13
  "build:node": "webpack --config webpack.node.config.js",
12
- "build": "npm run build:web && npm run build:node",
14
+ "build": "npm run build:declarations && npm run build:web && npm run build:node",
13
15
  "watch": "webpack --watch",
14
16
  "serve": "webpack serve",
15
17
  "test": "jest",
@@ -55,4 +57,4 @@
55
57
  "pixelmatch": "^7.1.0",
56
58
  "xlsx": "^0.18.5"
57
59
  }
58
- }
60
+ }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/common.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare const commonUtils: {
2
- delay: (seconds: number) => Promise<void>;
3
- };
4
- export default commonUtils;
package/dist/excel.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export interface jsonToExcelParams {
2
- mergeRow?: boolean;
3
- sheetName?: string;
4
- }
5
- declare const excelUtils: {
6
- jsonToExcel: (jsonData: any[], fileName?: string, params?: jsonToExcelParams) => any[];
7
- excelToJson: (filePath: string, sheetName?: string) => any[];
8
- };
9
- export default excelUtils;
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export type { SortOptions } from './json';
2
- declare const easyutilssdk: {
3
- common: {
4
- delay: (seconds: number) => Promise<void>;
5
- };
6
- json: {
7
- sortObjectKeys: (obj: any, { sortType }?: import("./json").SortOptions) => object | null;
8
- sortJson: (jsonString: string, { sortType }?: import("./json").SortOptions) => string;
9
- };
10
- };
11
- export default easyutilssdk;
package/dist/json.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export interface SortOptions {
2
- sortType?: 'asc' | 'desc';
3
- }
4
- declare const jsonUtils: {
5
- sortObjectKeys: (obj: any, { sortType }?: SortOptions) => object | null;
6
- sortJson: (jsonString: string, { sortType }?: SortOptions) => string;
7
- };
8
- export default jsonUtils;
@@ -1,61 +0,0 @@
1
- /**
2
- * 中间件系统核心类
3
- * 支持添加、移除和执行中间件
4
- */
5
- declare class MiddlewareManager {
6
- constructor();
7
- /**
8
- * 添加中间件
9
- * @param {Function} middleware - 中间件函数
10
- * @param {Object} options - 配置选项
11
- * @param {string} options.name - 中间件名称
12
- * @param {number} options.priority - 优先级,数字越大优先级越高
13
- */
14
- use(middleware: any, options?: {}): this;
15
- /**
16
- * 移除中间件
17
- * @param {string} name - 中间件名称
18
- */
19
- remove(name: any): this;
20
- /**
21
- * 执行所有中间件
22
- * @param {*} context - 上下文对象
23
- * @param {*} next - 下一个处理器
24
- */
25
- execute(context: any, next: any): Promise<void>;
26
- /**
27
- * 组合中间件函数
28
- * @param {Array} middlewares - 中间件数组
29
- * @returns {Function}
30
- */
31
- _compose(middlewares: any): (context: any, next: any) => Promise<any>;
32
- /**
33
- * 获取所有中间件信息
34
- * @returns {Array}
35
- */
36
- getMiddlewares(): any;
37
- }
38
- /**
39
- * 创建中间件管理器实例
40
- * @returns {MiddlewareManager}
41
- */
42
- export declare function createMiddlewareManager(): MiddlewareManager;
43
- /**
44
- * 工具函数:创建一个简单的日志中间件
45
- * @param {string} prefix - 日志前缀
46
- * @returns {Function}
47
- */
48
- export declare function createLoggerMiddleware(prefix?: string): (context: any, next: any) => any;
49
- /**
50
- * 工具函数:创建一个错误处理中间件
51
- * @param {Function} errorHandler - 错误处理器
52
- * @returns {Function}
53
- */
54
- export declare function createErrorMiddleware(errorHandler: any): (context: any, next: any) => any;
55
- /**
56
- * 工具函数:创建一个超时中间件
57
- * @param {number} timeout - 超时时间(毫秒)
58
- * @returns {Function}
59
- */
60
- export declare function createTimeoutMiddleware(timeout: any): (context: any, next: any) => Promise<unknown>;
61
- export default MiddlewareManager;
@@ -1,29 +0,0 @@
1
- /**
2
- * @module nodeBabel
3
- * @description Babel AST 工具模块,提供代码注释提取、处理和还原功能
4
- */
5
- /**
6
- * 提取代码文件中的注释选项
7
- */
8
- export interface extractCommentsToFileOptions {
9
- includeKeys?: string[];
10
- }
11
- /**
12
- * 主函数:提取指定文件的注释并保存到另一文件,然后从源文件中删除注释
13
- * @param sourcePath - 源文件路径
14
- * @param commentsOutputPath - 注释输出文件路径
15
- * @param metadataPath - 元数据文件路径
16
- * @param options - 提取选项
17
- */
18
- export declare function extractCommentsToFile(sourcePath: string, commentsOutputPath: string, metadataPath: string, options?: extractCommentsToFileOptions): Promise<void>;
19
- /**
20
- * 还原代码文件(将注释加回到无注释的代码中)
21
- * @param codePath - 无注释的代码文件路径
22
- * @param metadataPath - 元数据文件路径
23
- * @param outputPath - 还原后的代码输出路径
24
- */
25
- export declare function restoreCodeFromFile(codePath: string, metadataPath: string, outputPath: string): Promise<void>;
26
- export declare const nodeBabelUtils: {
27
- extractCommentsToFile: typeof extractCommentsToFile;
28
- restoreCodeFromFile: typeof restoreCodeFromFile;
29
- };
@@ -1,22 +0,0 @@
1
- /**
2
- * @module nodeExcel
3
- * @description Excel 文件处理工具模块,提供 Excel 与 JSON 格式相互转换的功能
4
- */
5
- /**
6
- * 将Excel文件转换为JSON数据
7
- * @param filePath - Excel文件路径
8
- * @param sheetName - 工作表名称(可选,默认为第一个工作表)
9
- * @returns JSON数据数组
10
- */
11
- export declare const excelToJson: (filePath: string, sheetName?: string) => any[];
12
- /**
13
- * 将Excel文件转换为JSON并保存到文件
14
- * @param excelPath - Excel文件路径
15
- * @param jsonPath - 输出JSON文件路径(可选,默认与Excel同名但扩展名为.json)
16
- * @param sheetName - 工作表名称(可选,默认为第一个工作表)
17
- */
18
- export declare const excelToJsonFile: (excelPath: string, jsonPath?: string, sheetName?: string) => void;
19
- export declare const nodeExcelUtils: {
20
- excelToJson: (filePath: string, sheetName?: string) => any[];
21
- excelToJsonFile: (excelPath: string, jsonPath?: string, sheetName?: string) => void;
22
- };
package/dist/node/fs.d.ts DELETED
@@ -1,37 +0,0 @@
1
- /**
2
- * @module nodeFs
3
- * @description 文件系统工具模块,提供文件和文件夹操作的实用方法
4
- */
5
- /**
6
- * 读取文件并转换为JSON,仅执行JSON.parse
7
- * @param filePath - 文件路径
8
- * @returns 转换之后的JSON对象
9
- */
10
- export declare const readFileToJSONSync: (filePath: string) => object;
11
- /**
12
- * 拷贝文件夹下所有文件至目标目录
13
- * todo 增加控制是否覆盖
14
- * @param source - 源文件夹
15
- * @param target - 目标文件夹
16
- */
17
- export declare const copyFolderSync: (source: string, target: string) => void;
18
- /**
19
- * 文件夹遍历回调方法
20
- * @param filePath - 文件路径
21
- * @param isDirectory - 是否为文件夹
22
- * @param index - 文件索引
23
- */
24
- export interface LoopFolderCallback {
25
- (filePath: string, isDirectory: boolean, index: number): void;
26
- }
27
- /**
28
- * 递归遍历文件夹执行特定回调
29
- * @param folderPath - 文件夹路径
30
- * @param callBack - 回调方法
31
- */
32
- export declare const loopFolderSync: (folderPath: string, callBack: LoopFolderCallback) => void;
33
- export declare const nodeFsUtils: {
34
- readFileToJSONSync: (filePath: string) => object;
35
- copyFolderSync: (source: string, target: string) => void;
36
- loopFolderSync: (folderPath: string, callBack: LoopFolderCallback) => void;
37
- };
@@ -1,4 +0,0 @@
1
- export * from './fs';
2
- export * from './babel';
3
- export * from './excel';
4
- export * from '../src/index';
package/dist/png.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import JSZip from "jszip";
2
- export interface pngCompareResult {
3
- diffNum: number;
4
- oldImageElement: HTMLImageElement;
5
- newImageElement: HTMLImageElement;
6
- diffImageData: HTMLImageElement;
7
- }
8
- declare const fileUtils: {
9
- zipUpdateToFiles: (e: any) => Promise<any>;
10
- htmlToPngUrl: (dom: HTMLElement) => Promise<string>;
11
- htmlToPngDownLoad: (dom: HTMLElement, fileName: string) => Promise<void>;
12
- htmlToPngAddToZip: (dom: HTMLElement, fileName: string, zipObj: JSZip) => Promise<void>;
13
- downLoadZip: (zipObj: JSZip, fileName: string) => Promise<void>;
14
- comparePng: (leftFile: File, rightFile: File) => Promise<pngCompareResult>;
15
- comparePngUrl: (leftPngUrl: string, rightPngUrl: string) => Promise<pngCompareResult>;
16
- };
17
- export default fileUtils;
package/dist/yyds.d.ts DELETED
File without changes