@ix-xs/node-comfort 1.1.2 → 1.1.31
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.
- package/README.md +255 -52
- package/package.json +6 -9
- package/src/SQLite.js +719 -174
- package/tsconfig.json +18 -0
- package/types/index.d.ts +120 -0
- package/types/index.d.ts.map +1 -0
- package/types/src/Checker.d.ts +145 -0
- package/types/src/Checker.d.ts.map +1 -0
- package/types/src/FS.d.ts +243 -0
- package/types/src/FS.d.ts.map +1 -0
- package/types/src/Logger.d.ts +35 -0
- package/types/src/Logger.d.ts.map +1 -0
- package/types/src/SQLite.d.ts +391 -0
- package/types/src/SQLite.d.ts.map +1 -0
- package/types/src/Utils.d.ts +124 -0
- package/types/src/Utils.d.ts.map +1 -0
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"outDir": "types",
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"moduleResolution": "nodenext",
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["**/*"],
|
|
17
|
+
"exclude": ["node_modules", "types"]
|
|
18
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
SQLite: {
|
|
3
|
+
new (path?: string): SQLite;
|
|
4
|
+
};
|
|
5
|
+
wait(ms: number): Promise<void>;
|
|
6
|
+
when(predicate: boolean | Promise<boolean> | (() => boolean | Promise<boolean>), payload?: any, options?: {
|
|
7
|
+
interval?: number | undefined;
|
|
8
|
+
timeout?: number | null | undefined;
|
|
9
|
+
max?: number | null | undefined;
|
|
10
|
+
}): {
|
|
11
|
+
start: () => any;
|
|
12
|
+
stop: () => any;
|
|
13
|
+
on: <E extends "error" | "trigger" | "timeout">(event: E, handler: E extends "error" ? (error: unknown) => void | Promise<void> : (payload: any) => void | Promise<void>) => any;
|
|
14
|
+
};
|
|
15
|
+
dontCrash(): {
|
|
16
|
+
on: <E extends "error" | "exit" | "sig" | "beforeExit">(event: E, handler?: (E extends "error" ? (error: Error | unknown) => void | Promise<void> : E extends "exit" ? (code: number) => void | Promise<void> : E extends "sig" ? (signal: "SIGINT" | "SIGTERM" | "SIGQUIT") => void | Promise<void> : (code: number) => void | Promise<void>)) => any;
|
|
17
|
+
};
|
|
18
|
+
JSONString(value: any): string;
|
|
19
|
+
JSONParse(value: string): any;
|
|
20
|
+
isArray(value: any): boolean;
|
|
21
|
+
isNumber(value: any): boolean;
|
|
22
|
+
isFunction(value: any): boolean;
|
|
23
|
+
isObject(value: any): boolean;
|
|
24
|
+
isBoolean(value: any): boolean;
|
|
25
|
+
isString(value: any): boolean;
|
|
26
|
+
isUndefined(value: any): boolean;
|
|
27
|
+
isNull(value: any): boolean;
|
|
28
|
+
isDate(value: any): boolean;
|
|
29
|
+
isMap(value: any): boolean;
|
|
30
|
+
isSet(value: any): boolean;
|
|
31
|
+
isError(value: any): boolean;
|
|
32
|
+
getEnv(value: string, envFilePath?: string): string | undefined;
|
|
33
|
+
createPath(path?: string): string;
|
|
34
|
+
getFoldersIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
35
|
+
getFolder(path?: string): string | undefined;
|
|
36
|
+
getFilesIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
37
|
+
getFile(path: string): string | undefined;
|
|
38
|
+
createFolder(path: string, force?: boolean): boolean | undefined;
|
|
39
|
+
createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean | undefined;
|
|
40
|
+
deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number | undefined;
|
|
41
|
+
deleteFolder(path: string): boolean | undefined;
|
|
42
|
+
deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number | undefined;
|
|
43
|
+
deleteFile(path: string): boolean | undefined;
|
|
44
|
+
copyFoldersIn(options: {
|
|
45
|
+
dest: string;
|
|
46
|
+
path?: string | undefined;
|
|
47
|
+
recursive?: boolean | undefined;
|
|
48
|
+
withFiles?: boolean | undefined;
|
|
49
|
+
force?: boolean | undefined;
|
|
50
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
51
|
+
}): number | undefined;
|
|
52
|
+
copyFolder(options: {
|
|
53
|
+
dest: string;
|
|
54
|
+
path?: string | undefined;
|
|
55
|
+
recursive?: boolean | undefined;
|
|
56
|
+
withFiles?: boolean | undefined;
|
|
57
|
+
force?: boolean | undefined;
|
|
58
|
+
}): boolean | undefined;
|
|
59
|
+
copyFilesIn(options: {
|
|
60
|
+
dest: string;
|
|
61
|
+
path?: string | undefined;
|
|
62
|
+
recursive?: boolean | undefined;
|
|
63
|
+
force?: boolean | undefined;
|
|
64
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
65
|
+
}): number | undefined;
|
|
66
|
+
copyFile(options: {
|
|
67
|
+
path: string;
|
|
68
|
+
dest: string;
|
|
69
|
+
force?: boolean | undefined;
|
|
70
|
+
}): boolean | undefined;
|
|
71
|
+
moveFoldersIn(options: {
|
|
72
|
+
dest: string;
|
|
73
|
+
path?: string | undefined;
|
|
74
|
+
recursive?: boolean | undefined;
|
|
75
|
+
withFiles?: boolean | undefined;
|
|
76
|
+
force?: boolean | undefined;
|
|
77
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
78
|
+
}): number | undefined;
|
|
79
|
+
moveFolder(options: {
|
|
80
|
+
path: string;
|
|
81
|
+
dest: string;
|
|
82
|
+
recursive?: boolean | undefined;
|
|
83
|
+
withFiles?: boolean | undefined;
|
|
84
|
+
force?: boolean | undefined;
|
|
85
|
+
}): boolean | undefined;
|
|
86
|
+
moveFilesIn(options: {
|
|
87
|
+
dest: string;
|
|
88
|
+
path?: string | undefined;
|
|
89
|
+
recursive?: boolean | undefined;
|
|
90
|
+
force?: boolean | undefined;
|
|
91
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
92
|
+
}): number | undefined;
|
|
93
|
+
moveFile(options: {
|
|
94
|
+
path: string;
|
|
95
|
+
dest: string;
|
|
96
|
+
force?: boolean | undefined;
|
|
97
|
+
}): boolean | undefined;
|
|
98
|
+
readFile(path: string): string | undefined;
|
|
99
|
+
watch(options?: {
|
|
100
|
+
path?: string | undefined;
|
|
101
|
+
recursive?: boolean | undefined;
|
|
102
|
+
filter?: ((event: "rename" | "change", file: string) => boolean) | undefined;
|
|
103
|
+
}): {
|
|
104
|
+
on: <E extends "change" | "rename" | "all">(event: E, callback: E extends "all" ? (event: "change" | "rename", file: string) => void | Promise<void> : (file: string) => void | Promise<void>) => any;
|
|
105
|
+
stop: () => void;
|
|
106
|
+
pause: () => any;
|
|
107
|
+
resume: () => any;
|
|
108
|
+
} | undefined;
|
|
109
|
+
setTimestamp(value: boolean): Logger;
|
|
110
|
+
setDelimiter(options?: {
|
|
111
|
+
open?: string | undefined;
|
|
112
|
+
close?: string | undefined;
|
|
113
|
+
}): Logger;
|
|
114
|
+
log(content: any): Logger;
|
|
115
|
+
group(label: string): Logger;
|
|
116
|
+
groupEnd(): Logger;
|
|
117
|
+
};
|
|
118
|
+
export = _exports;
|
|
119
|
+
import SQLite = require("./src/SQLite");
|
|
120
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;iFAYi3N,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAAn0C,MAAM;;;;QAAuZ,MAAM;uBAAiX,MAAM;0BAAq/B,MAAM;gBAA0T,MAAM"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a value is a real Array.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* nodeComfort.Checker.isArray([1, 2, 3]); // true
|
|
6
|
+
* nodeComfort.Checker.isArray("not array"); // false
|
|
7
|
+
*
|
|
8
|
+
* @param {*} value - Value to check.
|
|
9
|
+
* @returns {boolean} True if the value is an Array.
|
|
10
|
+
*/
|
|
11
|
+
export function isArray(value: any): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a value is a number (excluding NaN).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* nodeComfort.Checker.isNumber(42); // true
|
|
17
|
+
* nodeComfort.Checker.isNumber(NaN); // false
|
|
18
|
+
* nodeComfort.Checker.isNumber("42"); // false
|
|
19
|
+
*
|
|
20
|
+
* @param {*} value - Value to check.
|
|
21
|
+
* @returns {boolean} True if the value is a finite number or Infinity/-Infinity.
|
|
22
|
+
*/
|
|
23
|
+
export function isNumber(value: any): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a value is a function.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* nodeComfort.Checker.isFunction(() => {}); // true
|
|
29
|
+
* nodeComfort.Checker.isFunction(class {}); // true
|
|
30
|
+
* nodeComfort.Checker.isFunction("fn"); // false
|
|
31
|
+
*
|
|
32
|
+
* @param {*} value - Value to check.
|
|
33
|
+
* @returns {boolean} True if the value is a function.
|
|
34
|
+
*/
|
|
35
|
+
export function isFunction(value: any): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Checks if a value is a non-null object.
|
|
38
|
+
*
|
|
39
|
+
* Note: Arrays, Maps, Sets, Dates, etc. are also considered objects here.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* nodeComfort.Checker.isObject({}); // true
|
|
43
|
+
* nodeComfort.Checker.isObject([]); // true
|
|
44
|
+
* nodeComfort.Checker.isObject(null); // false
|
|
45
|
+
* nodeComfort.Checker.isObject("str"); // false
|
|
46
|
+
*
|
|
47
|
+
* @param {*} value - Value to check.
|
|
48
|
+
* @returns {boolean} True if the value is a non-null object.
|
|
49
|
+
*/
|
|
50
|
+
export function isObject(value: any): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a value is a boolean.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* nodeComfort.Checker.isBoolean(true); // true
|
|
56
|
+
* nodeComfort.Checker.isBoolean(false); // true
|
|
57
|
+
* nodeComfort.Checker.isBoolean(0); // false
|
|
58
|
+
*
|
|
59
|
+
* @param {*} value - Value to check.
|
|
60
|
+
* @returns {boolean} True if the value is a boolean.
|
|
61
|
+
*/
|
|
62
|
+
export function isBoolean(value: any): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a value is a string.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* nodeComfort.Checker.isString("hello"); // true
|
|
68
|
+
* nodeComfort.Checker.isString(123); // false
|
|
69
|
+
*
|
|
70
|
+
* @param {*} value - Value to check.
|
|
71
|
+
* @returns {boolean} True if the value is a string.
|
|
72
|
+
*/
|
|
73
|
+
export function isString(value: any): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if a value is exactly undefined.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* nodeComfort.Checker.isUndefined(undefined); // true
|
|
79
|
+
* nodeComfort.Checker.isUndefined(null); // false
|
|
80
|
+
*
|
|
81
|
+
* @param {*} value - Value to check.
|
|
82
|
+
* @returns {boolean} True if the value is undefined.
|
|
83
|
+
*/
|
|
84
|
+
export function isUndefined(value: any): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Checks if a value is exactly null.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* nodeComfort.Checker.isNull(null); // true
|
|
90
|
+
* nodeComfort.Checker.isNull(undefined); // false
|
|
91
|
+
*
|
|
92
|
+
* @param {*} value - Value to check.
|
|
93
|
+
* @returns {boolean} True if the value is null.
|
|
94
|
+
*/
|
|
95
|
+
export function isNull(value: any): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Checks if a value is a built-in Date instance.
|
|
98
|
+
*
|
|
99
|
+
* Uses `util.types.isDate` under the hood to handle cross-realm Dates.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* nodeComfort.Checker.isDate(new Date()); // true
|
|
103
|
+
* nodeComfort.Checker.isDate("2024-01-01"); // false
|
|
104
|
+
*
|
|
105
|
+
* @param {*} value - Value to check.
|
|
106
|
+
* @returns {boolean} True if the value is a Date instance.
|
|
107
|
+
*/
|
|
108
|
+
export function isDate(value: any): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Checks if a value is a built-in Map instance.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* nodeComfort.Checker.isMap(new Map()); // true
|
|
114
|
+
* nodeComfort.Checker.isMap({}); // false
|
|
115
|
+
*
|
|
116
|
+
* @param {*} value - Value to check.
|
|
117
|
+
* @returns {boolean} True if the value is a Map.
|
|
118
|
+
*/
|
|
119
|
+
export function isMap(value: any): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Checks if a value is a built-in Set instance.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* nodeComfort.Checker.isSet(new Set()); // true
|
|
125
|
+
* nodeComfort.Checker.isSet([]); // false
|
|
126
|
+
*
|
|
127
|
+
* @param {*} value - Value to check.
|
|
128
|
+
* @returns {boolean} True if the value is a Set.
|
|
129
|
+
*/
|
|
130
|
+
export function isSet(value: any): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Checks if a value is a native Error instance.
|
|
133
|
+
*
|
|
134
|
+
* Uses `util.types.isNativeError` to correctly handle errors from other realms.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* nodeComfort.Checker.isError(new Error("x")); // true
|
|
138
|
+
* nodeComfort.Checker.isError(new TypeError("x")); // true
|
|
139
|
+
* nodeComfort.Checker.isError({ message: "x" }); // false
|
|
140
|
+
*
|
|
141
|
+
* @param {*} value - Value to check.
|
|
142
|
+
* @returns {boolean} True if the value is a native Error.
|
|
143
|
+
*/
|
|
144
|
+
export function isError(value: any): boolean;
|
|
145
|
+
//# sourceMappingURL=Checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checker.d.ts","sourceRoot":"","sources":["../../src/Checker.js"],"names":[],"mappings":"AAQE;;;;;;;;;GASG;AACH,+BAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;;GAUG;AACH,gCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;;GAUG;AACH,kCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;;;;;GAaG;AACH,gCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;;GAUG;AACH,iCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;GASG;AACH,gCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;GASG;AACH,mCAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;GASG;AACH,8BAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;;;GAWG;AACH,8BAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;GASG;AACH,6BAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;GASG;AACH,6BAHW,GAAC,GACC,OAAO,CAInB;AAED;;;;;;;;;;;;GAYG;AACH,+BAHW,GAAC,GACC,OAAO,CAInB"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads an environment variable from process.env.
|
|
3
|
+
* @param {string} value - The environment variable name.
|
|
4
|
+
* @param {string} [envFilePath] - Reserved for future use.
|
|
5
|
+
* @returns {string|undefined} The environment value, or undefined if not set.
|
|
6
|
+
*/
|
|
7
|
+
export function getEnv(value: string, envFilePath?: string): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a path even when it does not already exist.
|
|
10
|
+
* @param {string} [path=process.cwd()] - The path to resolve.
|
|
11
|
+
* @returns {string} The resolved path.
|
|
12
|
+
*/
|
|
13
|
+
export function createPath(path?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns folders found inside a path.
|
|
16
|
+
* @param {string} [path=process.cwd()] - The base path to inspect.
|
|
17
|
+
* @param {boolean} [recursive=true] - Whether to scan recursively.
|
|
18
|
+
* @returns {string[]|undefined} Matching folders, or undefined if the path cannot be resolved.
|
|
19
|
+
*/
|
|
20
|
+
export function getFoldersIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the resolved folder path.
|
|
23
|
+
* @param {string} [path=process.cwd()] - The folder path to resolve.
|
|
24
|
+
* @returns {string|undefined} The resolved folder path, or undefined if not found.
|
|
25
|
+
*/
|
|
26
|
+
export function getFolder(path?: string): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Returns files found inside a path.
|
|
29
|
+
* @param {string} [path=process.cwd()] - The base path to inspect.
|
|
30
|
+
* @param {boolean} [recursive=true] - Whether to scan recursively.
|
|
31
|
+
* @returns {string[]|undefined} Matching files, or undefined if the path cannot be resolved.
|
|
32
|
+
*/
|
|
33
|
+
export function getFilesIn(path?: string, recursive?: boolean): string[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the resolved file path.
|
|
36
|
+
* @param {string} path - The file path to resolve.
|
|
37
|
+
* @returns {string|undefined} The resolved file path, or undefined if not found.
|
|
38
|
+
*/
|
|
39
|
+
export function getFile(path: string): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a folder.
|
|
42
|
+
* @param {string} path - The folder path to create.
|
|
43
|
+
* @param {boolean} [force=false] - Whether to recreate the folder if it already exists.
|
|
44
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if no path was provided.
|
|
45
|
+
*/
|
|
46
|
+
export function createFolder(path: string, force?: boolean): boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a file.
|
|
49
|
+
* @param {string} path - The file path to create.
|
|
50
|
+
* @param {boolean} [force=false] - Whether to recreate the file if it already exists.
|
|
51
|
+
* @param {string|object|null|undefined} [data] - File content to write.
|
|
52
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if no path was provided.
|
|
53
|
+
*/
|
|
54
|
+
export function createFile(path: string, force?: boolean, data?: string | object | null | undefined): boolean | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Deletes folders found inside a path.
|
|
57
|
+
* @param {string} [path=process.cwd()] - The base path to inspect.
|
|
58
|
+
* @param {(folder: string) => boolean} [filter=() => true] - Filter applied to each folder path.
|
|
59
|
+
* @returns {number|undefined} Number of deleted folders, or undefined if the path cannot be resolved.
|
|
60
|
+
*/
|
|
61
|
+
export function deleteFoldersIn(path?: string, filter?: (folder: string) => boolean): number | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Deletes a folder.
|
|
64
|
+
* @param {string} path - The folder path to delete.
|
|
65
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if the path is invalid.
|
|
66
|
+
*/
|
|
67
|
+
export function deleteFolder(path: string): boolean | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Deletes files found inside a path.
|
|
70
|
+
* @param {string} [path=process.cwd()] - The base path to inspect.
|
|
71
|
+
* @param {boolean} [recursive=false] - Whether to scan recursively.
|
|
72
|
+
* @param {(file: string) => boolean} [filter=() => true] - Filter applied to each file path.
|
|
73
|
+
* @returns {number|undefined} Number of deleted files, or undefined if the path cannot be resolved.
|
|
74
|
+
*/
|
|
75
|
+
export function deleteFilesIn(path?: string, recursive?: boolean, filter?: (file: string) => boolean): number | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Deletes a file.
|
|
78
|
+
* @param {string} path - The file path to delete.
|
|
79
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if the path is invalid.
|
|
80
|
+
*/
|
|
81
|
+
export function deleteFile(path: string): boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Copies folders from a source path into a destination folder.
|
|
84
|
+
* @param {Object} options - Copy options.
|
|
85
|
+
* @param {string} options.dest - Destination path.
|
|
86
|
+
* @param {string} [options.path] - Source path.
|
|
87
|
+
* @param {boolean} [options.recursive=true] - Whether to recurse into subfolders.
|
|
88
|
+
* @param {boolean} [options.withFiles=false] - Whether to copy files as well.
|
|
89
|
+
* @param {boolean} [options.force=false] - Whether to overwrite existing folders.
|
|
90
|
+
* @param {(folder: string) => boolean} [options.filter=() => true] - Filter applied to each folder.
|
|
91
|
+
* @returns {number|undefined} Number of copied folders, or undefined if invalid input.
|
|
92
|
+
*/
|
|
93
|
+
export function copyFoldersIn(options: {
|
|
94
|
+
dest: string;
|
|
95
|
+
path?: string | undefined;
|
|
96
|
+
recursive?: boolean | undefined;
|
|
97
|
+
withFiles?: boolean | undefined;
|
|
98
|
+
force?: boolean | undefined;
|
|
99
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
100
|
+
}): number | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Copies a folder to a destination path.
|
|
103
|
+
* @param {Object} options - Copy options.
|
|
104
|
+
* @param {string} options.dest - Destination path.
|
|
105
|
+
* @param {string} [options.path] - Source path.
|
|
106
|
+
* @param {boolean} [options.recursive=false] - Whether to copy subfolders.
|
|
107
|
+
* @param {boolean} [options.withFiles=false] - Whether to copy files.
|
|
108
|
+
* @param {boolean} [options.force=false] - Whether to overwrite the destination.
|
|
109
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if invalid input.
|
|
110
|
+
*/
|
|
111
|
+
export function copyFolder(options: {
|
|
112
|
+
dest: string;
|
|
113
|
+
path?: string | undefined;
|
|
114
|
+
recursive?: boolean | undefined;
|
|
115
|
+
withFiles?: boolean | undefined;
|
|
116
|
+
force?: boolean | undefined;
|
|
117
|
+
}): boolean | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Copies files from a source path into a destination folder.
|
|
120
|
+
* @param {Object} options - Copy options.
|
|
121
|
+
* @param {string} options.dest - Destination path.
|
|
122
|
+
* @param {string} [options.path] - Source path.
|
|
123
|
+
* @param {boolean} [options.recursive=true] - Whether to recurse into subfolders.
|
|
124
|
+
* @param {boolean} [options.force=false] - Whether to overwrite existing files.
|
|
125
|
+
* @param {(file: string) => boolean} [options.filter=() => true] - Filter applied to each file.
|
|
126
|
+
* @returns {number|undefined} Number of copied files, or undefined if invalid input.
|
|
127
|
+
*/
|
|
128
|
+
export function copyFilesIn(options: {
|
|
129
|
+
dest: string;
|
|
130
|
+
path?: string | undefined;
|
|
131
|
+
recursive?: boolean | undefined;
|
|
132
|
+
force?: boolean | undefined;
|
|
133
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
134
|
+
}): number | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Copies a file to a destination path.
|
|
137
|
+
* @param {Object} options - Copy options.
|
|
138
|
+
* @param {string} options.path - Source file path.
|
|
139
|
+
* @param {string} options.dest - Destination path.
|
|
140
|
+
* @param {boolean} [options.force=false] - Whether to overwrite the destination file.
|
|
141
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if invalid input.
|
|
142
|
+
*/
|
|
143
|
+
export function copyFile(options: {
|
|
144
|
+
path: string;
|
|
145
|
+
dest: string;
|
|
146
|
+
force?: boolean | undefined;
|
|
147
|
+
}): boolean | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Moves folders from a source path into a destination folder.
|
|
150
|
+
* @param {Object} options - Move options.
|
|
151
|
+
* @param {string} options.dest - Destination path.
|
|
152
|
+
* @param {string} [options.path] - Source path.
|
|
153
|
+
* @param {boolean} [options.recursive=true] - Whether to recurse into subfolders.
|
|
154
|
+
* @param {boolean} [options.withFiles=false] - Whether to move files as well.
|
|
155
|
+
* @param {boolean} [options.force=false] - Whether to overwrite existing folders.
|
|
156
|
+
* @param {(folder: string) => boolean} [options.filter=() => true] - Filter applied to each folder.
|
|
157
|
+
* @returns {number|undefined} Number of copied folders, or undefined if invalid input.
|
|
158
|
+
*/
|
|
159
|
+
export function moveFoldersIn(options: {
|
|
160
|
+
dest: string;
|
|
161
|
+
path?: string | undefined;
|
|
162
|
+
recursive?: boolean | undefined;
|
|
163
|
+
withFiles?: boolean | undefined;
|
|
164
|
+
force?: boolean | undefined;
|
|
165
|
+
filter?: ((folder: string) => boolean) | undefined;
|
|
166
|
+
}): number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Moves a folder to a destination path.
|
|
169
|
+
* @param {Object} options - Move options.
|
|
170
|
+
* @param {string} options.path - Source folder path.
|
|
171
|
+
* @param {string} options.dest - Destination path.
|
|
172
|
+
* @param {boolean} [options.recursive=false] - Whether to move subfolders.
|
|
173
|
+
* @param {boolean} [options.withFiles=false] - Whether to move files.
|
|
174
|
+
* @param {boolean} [options.force=false] - Whether to overwrite the destination.
|
|
175
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if invalid input.
|
|
176
|
+
*/
|
|
177
|
+
export function moveFolder(options: {
|
|
178
|
+
path: string;
|
|
179
|
+
dest: string;
|
|
180
|
+
recursive?: boolean | undefined;
|
|
181
|
+
withFiles?: boolean | undefined;
|
|
182
|
+
force?: boolean | undefined;
|
|
183
|
+
}): boolean | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Moves files from a source path into a destination folder.
|
|
186
|
+
* @param {Object} options - Move options.
|
|
187
|
+
* @param {string} options.dest - Destination path.
|
|
188
|
+
* @param {string} [options.path] - Source path.
|
|
189
|
+
* @param {boolean} [options.recursive=true] - Whether to recurse into subfolders.
|
|
190
|
+
* @param {boolean} [options.force=false] - Whether to overwrite existing files.
|
|
191
|
+
* @param {(file: string) => boolean} [options.filter=() => true] - Filter applied to each file.
|
|
192
|
+
* @returns {number|undefined} Number of copied files, or undefined if invalid input.
|
|
193
|
+
*/
|
|
194
|
+
export function moveFilesIn(options: {
|
|
195
|
+
dest: string;
|
|
196
|
+
path?: string | undefined;
|
|
197
|
+
recursive?: boolean | undefined;
|
|
198
|
+
force?: boolean | undefined;
|
|
199
|
+
filter?: ((file: string) => boolean) | undefined;
|
|
200
|
+
}): number | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Moves a file to a destination path.
|
|
203
|
+
* @param {Object} options - Move options.
|
|
204
|
+
* @param {string} options.path - Source file path.
|
|
205
|
+
* @param {string} options.dest - Destination path.
|
|
206
|
+
* @param {boolean} [options.force=false] - Whether to overwrite the destination file.
|
|
207
|
+
* @returns {boolean|undefined} True on success, false on failure, undefined if invalid input.
|
|
208
|
+
*/
|
|
209
|
+
export function moveFile(options: {
|
|
210
|
+
path: string;
|
|
211
|
+
dest: string;
|
|
212
|
+
force?: boolean | undefined;
|
|
213
|
+
}): boolean | undefined;
|
|
214
|
+
/**
|
|
215
|
+
* Reads a file as UTF-8 text.
|
|
216
|
+
* @param {string} path - The file path to read.
|
|
217
|
+
* @returns {string|undefined} File content, or undefined if the file cannot be read.
|
|
218
|
+
*/
|
|
219
|
+
export function readFile(path: string): string | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* Watches a path and exposes event listeners.
|
|
222
|
+
* @param {Object} [options] - Watch options.
|
|
223
|
+
* @param {string} [options.path=process.cwd()] - Path to watch.
|
|
224
|
+
* @param {boolean} [options.recursive=false] - Whether to watch recursively.
|
|
225
|
+
* @param {(event: "rename"|"change", file: string) => boolean} [options.filter] - Filter applied before dispatch.
|
|
226
|
+
* @returns {{
|
|
227
|
+
* on: <E extends "change"|"rename"|"all">(event: E, callback: E extends "all" ? (event: "change"|"rename", file: string) => void|Promise<void> : (file: string) => void|Promise<void>) => any,
|
|
228
|
+
* stop: () => void,
|
|
229
|
+
* pause: () => any,
|
|
230
|
+
* resume: () => any,
|
|
231
|
+
* }|undefined} Watch controller, or undefined if the path cannot be resolved.
|
|
232
|
+
*/
|
|
233
|
+
export function watch(options?: {
|
|
234
|
+
path?: string | undefined;
|
|
235
|
+
recursive?: boolean | undefined;
|
|
236
|
+
filter?: ((event: "rename" | "change", file: string) => boolean) | undefined;
|
|
237
|
+
}): {
|
|
238
|
+
on: <E extends "change" | "rename" | "all">(event: E, callback: E extends "all" ? (event: "change" | "rename", file: string) => void | Promise<void> : (file: string) => void | Promise<void>) => any;
|
|
239
|
+
stop: () => void;
|
|
240
|
+
pause: () => any;
|
|
241
|
+
resume: () => any;
|
|
242
|
+
} | undefined;
|
|
243
|
+
//# sourceMappingURL=FS.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../src/FS.js"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enables or disables timestamp in logs
|
|
3
|
+
* @param {boolean} value - True to enable, false to disable
|
|
4
|
+
* @returns {Logger} The same Logger instance (for chaining)
|
|
5
|
+
*/
|
|
6
|
+
export function setTimestamp(value: boolean): Logger;
|
|
7
|
+
/**
|
|
8
|
+
* Changes the delimiters used for text formatting
|
|
9
|
+
* @param {object} options - Delimiter options
|
|
10
|
+
* @param {string} [options.open] - New opening delimiter
|
|
11
|
+
* @param {string} [options.close] - New closing delimiter
|
|
12
|
+
* @returns {Logger} The same Logger instance (for chaining)
|
|
13
|
+
*/
|
|
14
|
+
export function setDelimiter(options?: {
|
|
15
|
+
open?: string | undefined;
|
|
16
|
+
close?: string | undefined;
|
|
17
|
+
}): Logger;
|
|
18
|
+
/**
|
|
19
|
+
* Prints a message to the console with ANSI formatting
|
|
20
|
+
* @param {*} content - Content to print (string, object, or other)
|
|
21
|
+
* @returns {Logger} The same Logger instance (for chaining)
|
|
22
|
+
*/
|
|
23
|
+
export function log(content: any): Logger;
|
|
24
|
+
/**
|
|
25
|
+
* Start a log group (displays a label and adds indentation)
|
|
26
|
+
* @param {string} label - The group name to display
|
|
27
|
+
* @returns {Logger} The same Logger instance (for chaining)
|
|
28
|
+
*/
|
|
29
|
+
export function group(label: string): Logger;
|
|
30
|
+
/**
|
|
31
|
+
* End the current log group
|
|
32
|
+
* @returns {Logger} The same Logger instance (for chaining)
|
|
33
|
+
*/
|
|
34
|
+
export function groupEnd(): Logger;
|
|
35
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/Logger.js"],"names":[],"mappings":"AA+NE;;;;GAIG;AACH,oCAHW,OAAO,GACL,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,uCAJG;IAAyB,IAAI;IACJ,KAAK;CAC9B,GAAU,MAAM,CAQlB;AAED;;;;GAIG;AACH,6BAHW,GAAC,GACC,MAAM,CAiClB;AAED;;;;GAIG;AACH,6BAHW,MAAM,GACJ,MAAM,CAOlB;AAED;;;GAGG;AACH,4BAFa,MAAM,CAKlB"}
|