@breadstone-infrastructure/utilities 0.0.71 → 0.0.73
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/CHANGELOG.md +26 -0
- package/IO/Directory.d.ts +8 -0
- package/IO/Directory.d.ts.map +1 -1
- package/IO/Directory.js +10 -0
- package/IO/Directory.js.map +1 -1
- package/IO/File.d.ts +47 -0
- package/IO/File.d.ts.map +1 -1
- package/IO/File.js +104 -0
- package/IO/File.js.map +1 -1
- package/IO/FileCache.d.ts +46 -0
- package/IO/FileCache.d.ts.map +1 -0
- package/IO/FileCache.js +94 -0
- package/IO/FileCache.js.map +1 -0
- package/IO/FileManifest.d.ts +57 -0
- package/IO/FileManifest.d.ts.map +1 -0
- package/IO/FileManifest.js +105 -0
- package/IO/FileManifest.js.map +1 -0
- package/IO/FileSystem.d.ts +488 -0
- package/IO/FileSystem.d.ts.map +1 -0
- package/IO/FileSystem.js +667 -0
- package/IO/FileSystem.js.map +1 -0
- package/IO/FileTracker.d.ts +73 -0
- package/IO/FileTracker.d.ts.map +1 -0
- package/IO/FileTracker.js +116 -0
- package/IO/FileTracker.js.map +1 -0
- package/IO/Interfaces/IDirectory.d.ts +115 -0
- package/IO/Interfaces/IDirectory.d.ts.map +1 -0
- package/IO/Interfaces/IDirectory.js +3 -0
- package/IO/Interfaces/IDirectory.js.map +1 -0
- package/IO/Interfaces/IFile.d.ts +152 -0
- package/IO/Interfaces/IFile.d.ts.map +1 -0
- package/IO/Interfaces/IFile.js +4 -0
- package/IO/Interfaces/IFile.js.map +1 -0
- package/IO/Interfaces/IFileCache.d.ts +56 -0
- package/IO/Interfaces/IFileCache.d.ts.map +1 -0
- package/IO/Interfaces/IFileCache.js +3 -0
- package/IO/Interfaces/IFileCache.js.map +1 -0
- package/IO/Interfaces/IFileSystem.d.ts +43 -0
- package/IO/Interfaces/IFileSystem.d.ts.map +1 -0
- package/IO/Interfaces/IFileSystem.js +4 -0
- package/IO/Interfaces/IFileSystem.js.map +1 -0
- package/IO/Interfaces/IFileTracker.d.ts +15 -0
- package/IO/Interfaces/IFileTracker.d.ts.map +1 -0
- package/IO/Interfaces/IFileTracker.js +4 -0
- package/IO/Interfaces/IFileTracker.js.map +1 -0
- package/IO/Interfaces/IPath.d.ts +97 -0
- package/IO/Interfaces/IPath.d.ts.map +1 -0
- package/IO/Interfaces/IPath.js +4 -0
- package/IO/Interfaces/IPath.js.map +1 -0
- package/IO/vNext/FileCache.d.ts +1 -1
- package/IO/vNext/FileTracker.d.ts +73 -0
- package/IO/vNext/FileTracker.d.ts.map +1 -0
- package/IO/vNext/FileTracker.js +116 -0
- package/IO/vNext/FileTracker.js.map +1 -0
- package/IO/vNext/Interfaces/IFileTracker.d.ts +15 -0
- package/IO/vNext/Interfaces/IFileTracker.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileTracker.js +4 -0
- package/IO/vNext/Interfaces/IFileTracker.js.map +1 -0
- package/Index.d.ts +7 -4
- package/Index.d.ts.map +1 -1
- package/Index.js +7 -4
- package/Index.js.map +1 -1
- package/README.md +36 -36
- package/package.json +2 -2
- package/IO/SymbolikLink.d.ts +0 -6
- package/IO/SymbolikLink.d.ts.map +0 -1
- package/IO/SymbolikLink.js +0 -10
- package/IO/SymbolikLink.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { IFileTracker } from './Interfaces/IFileTracker';
|
|
2
|
+
/**
|
|
3
|
+
* FileTracker manages and cleans up generated files based on a manifest.
|
|
4
|
+
* It also provides utility methods for writing and tracking files cleanly.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class FileTracker implements IFileTracker {
|
|
9
|
+
private readonly _rootDir;
|
|
10
|
+
private readonly _manifest;
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new instance of the `FileTracker` class.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
* @param rootDir The root directory where files will be tracked.
|
|
16
|
+
* @param manifestFilename The name of the manifest file (default is '.filetracker.json').
|
|
17
|
+
*/
|
|
18
|
+
constructor(rootDir: string, manifestFilename?: string);
|
|
19
|
+
/**
|
|
20
|
+
* Loads the previous manifest to determine which files were generated in the last run.
|
|
21
|
+
* This is necessary for cleanup operations.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
loadPreviousManifest(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Adds a file to the manifest as a generated file.
|
|
28
|
+
* The path is resolved relative to the root directory.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @param relativePath Path relative to the root directory
|
|
32
|
+
*/
|
|
33
|
+
addGeneratedFile(relativePath: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Cleans up files that were generated in previous runs but not in the current run.
|
|
36
|
+
* This helps to remove stale files that are no longer needed.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
cleanup(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Saves the current manifest, which includes all files tracked in this run.
|
|
43
|
+
* This should be called after all file operations are complete.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
saveManifest(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Writes a file to disk and tracks it in the manifest.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
* @param relativePath Path relative to the root directory
|
|
53
|
+
* @param content File content
|
|
54
|
+
* @param options Optional write options
|
|
55
|
+
*/
|
|
56
|
+
writeFile(relativePath: string, content: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Executes a custom file-writing callback and tracks the file.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
* @param relativePath Path relative to the root directory
|
|
62
|
+
* @param writer A callback that receives the absolute path to write content
|
|
63
|
+
*/
|
|
64
|
+
trackFile(relativePath: string, writer: (absolutePath: string) => Promise<void>): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Ensures that the directory for the given file path exists.
|
|
67
|
+
*
|
|
68
|
+
* @private
|
|
69
|
+
* @param fullFilePath The full path of the file to ensure its directory exists.
|
|
70
|
+
*/
|
|
71
|
+
private ensureDirectoryExists;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=FileTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileTracker.d.ts","sourceRoot":"","sources":["../../src/IO/FileTracker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAO9D;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,YAAY;IAI5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IAMzC;;;;;;OAMG;gBACgB,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAE,MAA4B;IAWlF;;;;;OAKG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlD;;;;;;OAMG;IACI,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAKnD;;;;;OAKG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;;;OAKG;IACU,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;;;;OAOG;IACU,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5E;;;;;;OAMG;IACU,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5G;;;;;OAKG;YACW,qBAAqB;CAUtC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FileTracker = void 0;
|
|
5
|
+
const FileManifest_1 = require("./FileManifest");
|
|
6
|
+
const Path_1 = require("./Path");
|
|
7
|
+
const File_1 = require("./File");
|
|
8
|
+
const Directory_1 = require("./Directory");
|
|
9
|
+
// #endregion
|
|
10
|
+
/**
|
|
11
|
+
* FileTracker manages and cleans up generated files based on a manifest.
|
|
12
|
+
* It also provides utility methods for writing and tracking files cleanly.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
class FileTracker {
|
|
17
|
+
// #region Fields
|
|
18
|
+
_rootDir;
|
|
19
|
+
_manifest;
|
|
20
|
+
// #endregion
|
|
21
|
+
// #region Ctor
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new instance of the `FileTracker` class.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* @param rootDir The root directory where files will be tracked.
|
|
27
|
+
* @param manifestFilename The name of the manifest file (default is '.filetracker.json').
|
|
28
|
+
*/
|
|
29
|
+
constructor(rootDir, manifestFilename = '.filetracker.json') {
|
|
30
|
+
this._rootDir = Path_1.Path.resolve(rootDir);
|
|
31
|
+
this._manifest = new FileManifest_1.FileManifest({
|
|
32
|
+
manifestPath: Path_1.Path.combine(this._rootDir, manifestFilename)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// #endregion
|
|
36
|
+
// #region Methods
|
|
37
|
+
/**
|
|
38
|
+
* Loads the previous manifest to determine which files were generated in the last run.
|
|
39
|
+
* This is necessary for cleanup operations.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
async loadPreviousManifest() {
|
|
44
|
+
await this._manifest.load();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Adds a file to the manifest as a generated file.
|
|
48
|
+
* The path is resolved relative to the root directory.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @param relativePath Path relative to the root directory
|
|
52
|
+
*/
|
|
53
|
+
addGeneratedFile(relativePath) {
|
|
54
|
+
const fullPath = Path_1.Path.resolve(this._rootDir, relativePath);
|
|
55
|
+
this._manifest.add(fullPath);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Cleans up files that were generated in previous runs but not in the current run.
|
|
59
|
+
* This helps to remove stale files that are no longer needed.
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
async cleanup() {
|
|
64
|
+
await this._manifest.cleanup();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Saves the current manifest, which includes all files tracked in this run.
|
|
68
|
+
* This should be called after all file operations are complete.
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
async saveManifest() {
|
|
73
|
+
await this._manifest.save();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Writes a file to disk and tracks it in the manifest.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
* @param relativePath Path relative to the root directory
|
|
80
|
+
* @param content File content
|
|
81
|
+
* @param options Optional write options
|
|
82
|
+
*/
|
|
83
|
+
async writeFile(relativePath, content) {
|
|
84
|
+
const fullPath = Path_1.Path.resolve(this._rootDir, relativePath);
|
|
85
|
+
await this.ensureDirectoryExists(fullPath);
|
|
86
|
+
await File_1.File.writeAllTextAsync(fullPath, content);
|
|
87
|
+
this.addGeneratedFile(relativePath);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Executes a custom file-writing callback and tracks the file.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
* @param relativePath Path relative to the root directory
|
|
94
|
+
* @param writer A callback that receives the absolute path to write content
|
|
95
|
+
*/
|
|
96
|
+
async trackFile(relativePath, writer) {
|
|
97
|
+
const fullPath = Path_1.Path.resolve(this._rootDir, relativePath);
|
|
98
|
+
await this.ensureDirectoryExists(fullPath);
|
|
99
|
+
await writer(fullPath);
|
|
100
|
+
this.addGeneratedFile(relativePath);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Ensures that the directory for the given file path exists.
|
|
104
|
+
*
|
|
105
|
+
* @private
|
|
106
|
+
* @param fullFilePath The full path of the file to ensure its directory exists.
|
|
107
|
+
*/
|
|
108
|
+
async ensureDirectoryExists(fullFilePath) {
|
|
109
|
+
const dir = Path_1.Path.getDirectoryName(fullFilePath);
|
|
110
|
+
if (!Directory_1.Directory.exists(dir)) {
|
|
111
|
+
await Directory_1.Directory.createAsync(dir);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.FileTracker = FileTracker;
|
|
116
|
+
//# sourceMappingURL=FileTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileTracker.js","sourceRoot":"","sources":["../../src/IO/FileTracker.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,iDAA8C;AAE9C,iCAA8B;AAC9B,iCAA8B;AAC9B,2CAAwC;AAExC,aAAa;AAEb;;;;;GAKG;AACH,MAAa,WAAW;IAEpB,iBAAiB;IAEA,QAAQ,CAAS;IACjB,SAAS,CAAe;IAEzC,aAAa;IAEb,eAAe;IAEf;;;;;;OAMG;IACH,YAAmB,OAAe,EAAE,mBAA2B,mBAAmB;QAC9E,IAAI,CAAC,QAAQ,GAAG,WAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,IAAI,2BAAY,CAAC;YAC9B,YAAY,EAAE,WAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAC9D,CAAC,CAAC;IACP,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;;OAKG;IACI,KAAK,CAAC,oBAAoB;QAC7B,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACI,gBAAgB,CAAC,Y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CAAC,EAAE,CAAC;YACzB,MAAM,qBAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;CAIJ;AApHD,kCAoHC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a directory utility interface that provides methods for directory operations.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IDirectory {
|
|
7
|
+
/**
|
|
8
|
+
* Creates all directories and subdirectories in the specified path unless they already exist.
|
|
9
|
+
* @param path The directory to create.
|
|
10
|
+
*/
|
|
11
|
+
create(path: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Asynchronously creates all directories and subdirectories in the specified path unless they already exist.
|
|
14
|
+
* @param path The directory to create.
|
|
15
|
+
* @returns A promise that resolves when the directory is created.
|
|
16
|
+
*/
|
|
17
|
+
createAsync(path: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Deletes an empty directory from a specified path.
|
|
20
|
+
* @param path The name of the directory to remove.
|
|
21
|
+
*/
|
|
22
|
+
delete(path: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Asynchronously deletes an empty directory from a specified path.
|
|
25
|
+
* @param path The name of the directory to remove.
|
|
26
|
+
* @returns A promise that resolves when the directory is deleted.
|
|
27
|
+
*/
|
|
28
|
+
deleteAsync(path: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether the given path refers to an existing directory on disk.
|
|
31
|
+
* @param path The path to test.
|
|
32
|
+
* @returns true if path refers to an existing directory; false if the directory does not exist or an error occurs.
|
|
33
|
+
*/
|
|
34
|
+
exists(path: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Asynchronously determines whether the given path refers to an existing directory on disk.
|
|
37
|
+
* @param path The path to test.
|
|
38
|
+
* @returns A promise that resolves to true if the directory exists; otherwise, false.
|
|
39
|
+
*/
|
|
40
|
+
existsAsync(path: string): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Determines the total count of files and folders in the directory.
|
|
43
|
+
* @param path The directory path.
|
|
44
|
+
* @returns The number of files and folders.
|
|
45
|
+
*/
|
|
46
|
+
count(path: string): number;
|
|
47
|
+
/**
|
|
48
|
+
* Asynchronously determines the total count of files and folders in the directory.
|
|
49
|
+
* @param path The directory path.
|
|
50
|
+
* @returns A promise that resolves to the number of files and folders.
|
|
51
|
+
*/
|
|
52
|
+
countAsync(path: string): Promise<number>;
|
|
53
|
+
/**
|
|
54
|
+
* Gets the size of a directory.
|
|
55
|
+
* @param path The directory path.
|
|
56
|
+
* @returns The directory size in bytes.
|
|
57
|
+
*/
|
|
58
|
+
size(path: string): number;
|
|
59
|
+
/**
|
|
60
|
+
* Asynchronously gets the size of a directory.
|
|
61
|
+
* @param path The directory path.
|
|
62
|
+
* @returns A promise that resolves to the directory size in bytes.
|
|
63
|
+
*/
|
|
64
|
+
sizeAsync(path: string): Promise<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves the parent directory of the specified path.
|
|
67
|
+
* @param path The path for which to retrieve the parent directory.
|
|
68
|
+
* @returns The parent directory path or null if not available.
|
|
69
|
+
*/
|
|
70
|
+
getParent(path: string): string | null;
|
|
71
|
+
/**
|
|
72
|
+
* Asynchronously retrieves the parent directory of the specified path.
|
|
73
|
+
* @param path The path for which to retrieve the parent directory.
|
|
74
|
+
* @returns A promise that resolves to the parent directory path or null if not available.
|
|
75
|
+
*/
|
|
76
|
+
getParentAsync(path: string): Promise<string | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Lists all files in a directory recursively in a synchronous fashion.
|
|
79
|
+
* @param path The root directory path.
|
|
80
|
+
* @returns An iterable iterator of file paths.
|
|
81
|
+
*/
|
|
82
|
+
walk(path: string): IterableIterator<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Lists all files in a directory recursively in an asynchronous fashion.
|
|
85
|
+
* @param path The root directory path.
|
|
86
|
+
* @returns An async iterable iterator of file paths.
|
|
87
|
+
*/
|
|
88
|
+
walkAsync(path: string): AsyncIterableIterator<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Finds directories using glob patterns.
|
|
91
|
+
* @param pattern The globbing pattern(s).
|
|
92
|
+
* @returns An array of directory paths.
|
|
93
|
+
*/
|
|
94
|
+
glob(pattern: string | Array<string>): Array<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Asynchronously finds directories using glob patterns.
|
|
97
|
+
* @param pattern The globbing pattern(s).
|
|
98
|
+
* @returns A promise that resolves to an array of directory paths.
|
|
99
|
+
*/
|
|
100
|
+
globAsync(pattern: string | Array<string>): Promise<Array<string>>;
|
|
101
|
+
/**
|
|
102
|
+
* Copies a directory to a new location.
|
|
103
|
+
* @param sourcePath The source directory path.
|
|
104
|
+
* @param targetPath The target directory path.
|
|
105
|
+
*/
|
|
106
|
+
copy(sourcePath: string, targetPath: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Asynchronously copies a directory to a new location.
|
|
109
|
+
* @param sourcePath The source directory path.
|
|
110
|
+
* @param targetPath The target directory path.
|
|
111
|
+
* @returns A promise that resolves when the copy operation is complete.
|
|
112
|
+
*/
|
|
113
|
+
copyAsync(sourcePath: string, targetPath: string): Promise<void>;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=IDirectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDirectory.d.ts","sourceRoot":"","sources":["../../../src/IO/Interfaces/IDirectory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAIvB;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GA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IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAIpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDirectory.js","sourceRoot":"","sources":["../../../src/IO/Interfaces/IDirectory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Encoding } from '../Encoding';
|
|
2
|
+
import { JSONObject } from '../Json';
|
|
3
|
+
import { IResxEntry } from '../Resx';
|
|
4
|
+
import { SymbolicLink } from '../SymbolicLink';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a file utility interface that provides methods for file operations.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface IFile {
|
|
11
|
+
/**
|
|
12
|
+
* Determines whether the specified file exists.
|
|
13
|
+
* @param path The file to check.
|
|
14
|
+
* @returns `true` if the file exists; otherwise, `false`.
|
|
15
|
+
*/
|
|
16
|
+
exists(path: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Copies an existing file to a new file.
|
|
19
|
+
* @param sourceFileName The file to copy.
|
|
20
|
+
* @param destFileName The destination file.
|
|
21
|
+
* @param overwrite If true, overwrite the destination file.
|
|
22
|
+
*/
|
|
23
|
+
copy(sourceFileName: string, destFileName: string, overwrite?: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Reads all text from a file.
|
|
26
|
+
* @param path The file to read.
|
|
27
|
+
* @param encoding The encoding to use.
|
|
28
|
+
* @param validateCase If true, checks casing of the path.
|
|
29
|
+
* @returns The file content as string.
|
|
30
|
+
*/
|
|
31
|
+
readAllText(path: string, encoding?: Encoding, validateCase?: boolean): string;
|
|
32
|
+
/**
|
|
33
|
+
* Asynchronously reads all text from a file.
|
|
34
|
+
* @param path The file to read.
|
|
35
|
+
* @param encoding The encoding to use.
|
|
36
|
+
* @param validateCase If true, checks casing of the path.
|
|
37
|
+
* @returns A promise with the file content as string.
|
|
38
|
+
*/
|
|
39
|
+
readAllTextAsync(path: string, encoding?: Encoding, validateCase?: boolean): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Reads all bytes from a file.
|
|
42
|
+
* @param path The file to read.
|
|
43
|
+
* @returns The content as Buffer.
|
|
44
|
+
*/
|
|
45
|
+
readAllBytes(path: string): Buffer;
|
|
46
|
+
/**
|
|
47
|
+
* Asynchronously reads all bytes from a file.
|
|
48
|
+
* @param path The file to read.
|
|
49
|
+
* @returns A promise with the content as Buffer.
|
|
50
|
+
*/
|
|
51
|
+
readAllBytesAsync(path: string): Promise<Buffer>;
|
|
52
|
+
/**
|
|
53
|
+
* Writes all text to a file, overwriting if it exists.
|
|
54
|
+
* @param path The file to write.
|
|
55
|
+
* @param contents The text to write.
|
|
56
|
+
* @param encoding The encoding to use.
|
|
57
|
+
* @param validateCase If true, checks casing of the path.
|
|
58
|
+
*/
|
|
59
|
+
writeAllText(path: string, contents: string, encoding?: Encoding, validateCase?: boolean): void;
|
|
60
|
+
/**
|
|
61
|
+
* Asynchronously writes all text to a file, overwriting if it exists.
|
|
62
|
+
* @param path The file to write.
|
|
63
|
+
* @param contents The text to write.
|
|
64
|
+
* @param encoding The encoding to use.
|
|
65
|
+
* @param validateCase If true, checks casing of the path.
|
|
66
|
+
*/
|
|
67
|
+
writeAllTextAsync(path: string, contents: string, encoding?: Encoding, validateCase?: boolean): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Writes JSON data to a file.
|
|
70
|
+
* @param path The file to write.
|
|
71
|
+
* @param data The JSON data to write.
|
|
72
|
+
* @param encoding The encoding to use.
|
|
73
|
+
*/
|
|
74
|
+
writeAllJson(path: string, data: unknown, encoding?: Encoding): void;
|
|
75
|
+
/**
|
|
76
|
+
* Asynchronously writes JSON data to a file.
|
|
77
|
+
* @param path The file to write.
|
|
78
|
+
* @param data The JSON data to write.
|
|
79
|
+
* @param encoding The encoding to use.
|
|
80
|
+
* @returns A promise that resolves when the write operation is complete.
|
|
81
|
+
*/
|
|
82
|
+
writeAllJsonAsync(path: string, data: unknown, encoding?: Encoding): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Deletes the specified file.
|
|
85
|
+
* @param path The file to delete.
|
|
86
|
+
*/
|
|
87
|
+
delete(path: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Asynchronously deletes the specified file.
|
|
90
|
+
* @param path The file to delete.
|
|
91
|
+
*/
|
|
92
|
+
deleteAsync(path: string): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Moves a file to a new location.
|
|
95
|
+
* @param sourceFileName The source file.
|
|
96
|
+
* @param destFileName The destination file.
|
|
97
|
+
*/
|
|
98
|
+
move(sourceFileName: string, destFileName: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Reads JSON data from a file.
|
|
101
|
+
* @param file The file to read.
|
|
102
|
+
* @returns The JSON object.
|
|
103
|
+
*/
|
|
104
|
+
readAllJson(file: string): JSONObject;
|
|
105
|
+
/**
|
|
106
|
+
* Reads a RESX file and returns entries.
|
|
107
|
+
* @param file The resx file to read.
|
|
108
|
+
* @returns Array of RESX entries.
|
|
109
|
+
*/
|
|
110
|
+
readAllResx(file: string): Array<IResxEntry>;
|
|
111
|
+
/**
|
|
112
|
+
* Reads and parses an XML file.
|
|
113
|
+
* @param file The xml file to read.
|
|
114
|
+
* @returns Parsed XML object.
|
|
115
|
+
*/
|
|
116
|
+
readAllXml<T = unknown>(file: string): T;
|
|
117
|
+
/**
|
|
118
|
+
* Creates a hash from a file.
|
|
119
|
+
* @param file The file to hash.
|
|
120
|
+
* @param algorithm Hash algorithm.
|
|
121
|
+
* @param encoding Hash encoding.
|
|
122
|
+
* @returns A promise with hash as string or buffer.
|
|
123
|
+
*/
|
|
124
|
+
hash(file: string, algorithm?: 'sha1' | 'md5', encoding?: 'hex' | 'binary'): Promise<string | Buffer>;
|
|
125
|
+
/**
|
|
126
|
+
* Finds files using glob patterns.
|
|
127
|
+
* @param pattern The glob pattern(s).
|
|
128
|
+
* @returns Array of file paths.
|
|
129
|
+
*/
|
|
130
|
+
glob(pattern: string | Array<string>): Array<string>;
|
|
131
|
+
/**
|
|
132
|
+
* Extracts the locale from a file.
|
|
133
|
+
* @param file The file.
|
|
134
|
+
* @param defaultLocale The default locale.
|
|
135
|
+
* @returns The locale string.
|
|
136
|
+
*/
|
|
137
|
+
getLocale(file: string, defaultLocale?: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* Gets the size of a file.
|
|
140
|
+
* @param file The file.
|
|
141
|
+
* @returns The file size.
|
|
142
|
+
*/
|
|
143
|
+
size(file: string): number;
|
|
144
|
+
/**
|
|
145
|
+
* Creates a symbolic link.
|
|
146
|
+
* @param src The source path.
|
|
147
|
+
* @param dest The destination path.
|
|
148
|
+
* @param symbolicLink The symbolic link type.
|
|
149
|
+
*/
|
|
150
|
+
createSymbolicLink(src: string, dest: string, symbolicLink: SymbolicLink): void;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=IFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFile.d.ts","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C;;;;GAIG;AACH,MAAM,WAAW,KAAK;IAIlB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9B;;;;;OAKG;IACH,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE9E;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MA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Y,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzD;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAEtC;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAE7C;;;;OAIG;IACH,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC;IAEzC;;;;;;OAMG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEtG;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAErD;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExD;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAE3B;;;;;OAKG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;CAInF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFile.js","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFile.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for configuring the file cache.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IFileCacheOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The directory path where cached files are stored.
|
|
9
|
+
*/
|
|
10
|
+
dirPath: string;
|
|
11
|
+
/**
|
|
12
|
+
* Flag indicating whether caching is enabled.
|
|
13
|
+
*/
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Interface defining the operations of the file cache.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface IFileCache {
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a directory is cached.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* @param dirPath - The directory to check.
|
|
27
|
+
* @returns A promise resolving to `true` if the directory is cached, otherwise `false`.
|
|
28
|
+
*/
|
|
29
|
+
isDirectoryCached(dirPath: string): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a file is cached.
|
|
32
|
+
* If not and caching is enabled, the file will be cached.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
* @param file - The file to check.
|
|
36
|
+
* @returns A promise resolving to `true` if the file is cached, otherwise `false`.
|
|
37
|
+
*/
|
|
38
|
+
isFileCached(file: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the token of a file.
|
|
41
|
+
* The token is used to identify the file in the cache.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
* @param file - The file for which to generate a token.
|
|
45
|
+
* @returns The token of the file.
|
|
46
|
+
*/
|
|
47
|
+
getFileToken(file: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Deletes a file from the cache.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
* @param token - The token of the file to delete.
|
|
53
|
+
*/
|
|
54
|
+
deleteFile(token: string): void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=IFileCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileCache.d.ts","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFileCache.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAI9B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAIrB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAIvB;;;;;;OAMG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAInC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileCache.js","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFileCache.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IFile } from './IFile';
|
|
2
|
+
import { IDirectory } from './IDirectory';
|
|
3
|
+
import { IPath } from './IPath';
|
|
4
|
+
import { EventEmitter } from 'node:stream';
|
|
5
|
+
/**
|
|
6
|
+
* Utility type to create unique method names by appending a suffix to each key of an interface.
|
|
7
|
+
*
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
type UniqueMethods<T, Key extends string> = {
|
|
11
|
+
[K in keyof T as `${Lowercase<Key>}${Capitalize<string & K>}`]: T[K];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Represents the event map for file system events.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface IFileSystemEventMap {
|
|
19
|
+
directoryCreated: [filePath: string];
|
|
20
|
+
directoryChanged: [filePath: string];
|
|
21
|
+
directoryDeleted: [filePath: string];
|
|
22
|
+
fileCreated: [filePath: string];
|
|
23
|
+
fileChanged: [filePath: string];
|
|
24
|
+
fileDeleted: [filePath: string];
|
|
25
|
+
error: [error: Error];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Represents a file system interface that provides methods for file, directory, and path operations.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export interface IFileSystem extends UniqueMethods<IFile, 'File'>, UniqueMethods<IDirectory, 'Directory'>, UniqueMethods<IPath, 'Path'>, EventEmitter<IFileSystemEventMap> {
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a file or directory exists and returns its type.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
* @param filePath - The path to the file.
|
|
38
|
+
* @returns 'file' if it is a file, 'directory' if it is a directory, or 'unknown' if it does not exist or is neither.
|
|
39
|
+
*/
|
|
40
|
+
isFileOrDirectory(inputPath: string): 'file' | 'directory' | 'unknown';
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=IFileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileSystem.d.ts","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFileSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C;;;;GAIG;AACH,KAAK,aAAa,CAAC,CAAC,EAAE,GAAG,SAAS,MAAM,IAAI;KACvC,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;CACvE,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,WACb,SAAQ,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,mBAAmB,CAAC;IAI7I;;;;;;OAMG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CAI1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileSystem.js","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFileSystem.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WriteFileOptions } from 'fs';
|
|
2
|
+
/**
|
|
3
|
+
* Interface defining the contract for tracking generated files.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IFileTracker {
|
|
8
|
+
loadPreviousManifest(): Promise<void>;
|
|
9
|
+
addGeneratedFile(relativePath: string): void;
|
|
10
|
+
cleanup(): Promise<void>;
|
|
11
|
+
saveManifest(): Promise<void>;
|
|
12
|
+
writeFile(relativePath: string, content: string, options?: WriteFileOptions): Promise<void>;
|
|
13
|
+
trackFile(relativePath: string, writer: (absolutePath: string) => Promise<void>): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=IFileTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileTracker.d.ts","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFileTracker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAI3C;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFileTracker.js","sourceRoot":"","sources":["../../../src/IO/Interfaces/IFileTracker.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|