@e-mc/file-manager 0.10.0 → 0.10.2
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/LICENSE +10 -10
- package/README.md +321 -321
- package/index.d.ts +5 -5
- package/index.js +33 -35
- package/package.json +37 -37
package/LICENSE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright 2024 An Pham
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
11
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,322 +1,322 @@
|
|
|
1
|
-
# @e-mc/file-manager
|
|
2
|
-
|
|
3
|
-
* NodeJS 16
|
|
4
|
-
* ES2020
|
|
5
|
-
|
|
6
|
-
## General Usage
|
|
7
|
-
|
|
8
|
-
* [Read the Docs](https://e-mc.readthedocs.io)
|
|
9
|
-
|
|
10
|
-
## Interface
|
|
11
|
-
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.
|
|
13
|
-
|
|
14
|
-
```typescript
|
|
15
|
-
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
16
|
-
|
|
17
|
-
import type { DocumentConstructor, HostConstructor, ICloud, ICompress, IDocument, IHost, IImage, IModule, IRequest, ITask, ImageConstructor, TaskConstructor, WatchInstance } from "./index";
|
|
18
|
-
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from "./asset";
|
|
19
|
-
import type { IPermission, PermissionReadWrite } from "./core";
|
|
20
|
-
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from "./filemanager";
|
|
21
|
-
import type { ExecCommand } from "./logger";
|
|
22
|
-
import type { CopyFileOptions, CreateDirOptions, DeleteFileOptions, MoveFileOptions, ReadFileOptions, RemoveDirOptions, WriteFileOptions } from "./module";
|
|
23
|
-
import type { RequestData, Settings } from "./node";
|
|
24
|
-
import type { Aria2Options, BufferFormat, OpenOptions } from "./request";
|
|
25
|
-
import type { CloudModule, CompressModule, DbModule, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, TaskModule, WatchModule } from "./settings";
|
|
26
|
-
|
|
27
|
-
import type { SpawnOptions } from "child_process";
|
|
28
|
-
import type { NoParamCallback } from "fs";
|
|
29
|
-
|
|
30
|
-
interface IFileManager extends IHost, Set<string> {
|
|
31
|
-
processTimeout: number;
|
|
32
|
-
cacheToDisk: IHttpDiskCache<ExternalAsset>;
|
|
33
|
-
cacheToMemory: IHttpMemoryCache<ExternalAsset>;
|
|
34
|
-
Request: IRequest;
|
|
35
|
-
Document: InstallData<IDocument<IFileManager, ExternalAsset>, DocumentConstructor<IFileManager, ExternalAsset>>[];
|
|
36
|
-
Task: InstallData<ITask, TaskConstructor>[];
|
|
37
|
-
Image: Map<ImageMimeMap> | null;
|
|
38
|
-
Cloud: ICloud | null;
|
|
39
|
-
Watch: WatchInstance<ExternalAsset> | null;
|
|
40
|
-
Compress: ICompress | null;
|
|
41
|
-
readonly documentAssets: ExternalAsset[];
|
|
42
|
-
readonly taskAssets: (ExternalAsset & Required<TaskAction>)[];
|
|
43
|
-
readonly dataSourceItems: DataSource[];
|
|
44
|
-
readonly files: Set<string>;
|
|
45
|
-
readonly filesQueued: Set<string>;
|
|
46
|
-
readonly filesToRemove: Set<string>;
|
|
47
|
-
readonly filesToCompare: Map<ExternalAsset, string[]>;
|
|
48
|
-
readonly contentToAppend: Map<string, string[]>;
|
|
49
|
-
readonly contentToReplace: Map<string, string[]>;
|
|
50
|
-
readonly processing: IFileThread[];
|
|
51
|
-
readonly fetchedAssets: ExternalAsset[];
|
|
52
|
-
readonly copiedAssets: ExternalAsset[];
|
|
53
|
-
readonly emptyDir: Set<string>;
|
|
54
|
-
install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): IDocument | undefined;
|
|
55
|
-
install(name: "document", target: DocumentConstructor, module?: DocumentModule, ...args: unknown[]): IDocument | undefined;
|
|
56
|
-
install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): ITask | undefined;
|
|
57
|
-
install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): ITask | undefined;
|
|
58
|
-
install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): ICloud | undefined;
|
|
59
|
-
install(name: "cloud", module?: CloudModule, ...args: unknown[]): ICloud | undefined;
|
|
60
|
-
install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): IImage | undefined;
|
|
61
|
-
install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): IImage | undefined;
|
|
62
|
-
install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
|
|
63
|
-
install(name: "watch", module: WatchModule): WatchInstance<ExternalAsset> | undefined;
|
|
64
|
-
install(name: "watch", interval?: number | string, port?: number | string, securePort?: number | string, extensions?: unknown[]): WatchInstance<ExternalAsset> | undefined;
|
|
65
|
-
install(name: "compress", module?: CompressModule): ICompress | undefined;
|
|
66
|
-
install(name: string, ...args: unknown[]): IModule | undefined;
|
|
67
|
-
using(...items: ExternalAsset[] | [boolean, ...ExternalAsset[]]): this;
|
|
68
|
-
contains(item: ExternalAsset, condition?: (target: ExternalAsset) => boolean): boolean;
|
|
69
|
-
removeCwd(value: unknown): string;
|
|
70
|
-
findAsset(value: string | URL, instance?: IModule | FindAssetOptions<ExternalAsset>): ExternalAsset | undefined;
|
|
71
|
-
removeAsset(file: ExternalAsset): boolean;
|
|
72
|
-
replace(file: ExternalAsset, replaceWith: string, mimeType: Undef<string>): boolean;
|
|
73
|
-
replace(file: ExternalAsset, replaceWith: string, options?: ReplaceOptions): boolean;
|
|
74
|
-
rename(file: ExternalAsset, value: string): boolean;
|
|
75
|
-
performAsyncTask(): void;
|
|
76
|
-
removeAsyncTask(): void;
|
|
77
|
-
completeAsyncTask(err?: unknown, uri?: string, parent?: ExternalAsset, type?: number): void;
|
|
78
|
-
performFinalize(override?: boolean): void;
|
|
79
|
-
hasDocument(instance: IModule, document: string | string[] | undefined): boolean;
|
|
80
|
-
getDocumentAssets(instance: IModule, condition?: (target: ExternalAsset) => boolean): ExternalAsset[];
|
|
81
|
-
getDataSourceItems(instance: IModule, condition?: (target: DataSource) => boolean): DataSource[];
|
|
82
|
-
checkFilename(file: ExternalAsset, pathname?: string): string;
|
|
83
|
-
setLocalUri(file: ExternalAsset, replace?: boolean): FileOutput;
|
|
84
|
-
getLocalUri(data: FileData<ExternalAsset>): string;
|
|
85
|
-
getMimeType(data: FileData<ExternalAsset>): string;
|
|
86
|
-
openThread(instance: IModule, data: IFileThread, timeout?: number): boolean;
|
|
87
|
-
closeThread(instance: IModule | null, data: IFileThread, callback?: (...args: unknown[]) => void): boolean;
|
|
88
|
-
addProcessTimeout(instance: IModule, file: ExternalAsset, timeout: number): void;
|
|
89
|
-
removeProcessTimeout(instance: IModule, file: ExternalAsset): void;
|
|
90
|
-
getProcessTimeout(handler: InstallData): number;
|
|
91
|
-
clearProcessTimeout(): void;
|
|
92
|
-
scheduleTask(url: string | URL, data: unknown, priority: number): Promise<unknown>;
|
|
93
|
-
scheduleTask(url: string | URL, data: unknown, thenCallback?: (...args: unknown[]) => unknown, catchCallback?: (...args: unknown[]) => unknown, priority?: number): Promise<unknown>;
|
|
94
|
-
setTaskLimit(value: number): void;
|
|
95
|
-
addDownload(value: number | Buffer | string, encoding: BufferEncoding): number;
|
|
96
|
-
addDownload(value: number | Buffer | string, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
|
|
97
|
-
getDownload(type?: number): [number, number];
|
|
98
|
-
transformAsset(data: IFileThread, parent?: ExternalAsset, override?: boolean): Promise<boolean>;
|
|
99
|
-
addCopy(data: FileCommand<ExternalAsset>, saveAs?: string, replace?: boolean): string | undefined;
|
|
100
|
-
findMime(file: ExternalAsset, rename?: boolean): Promise<string>;
|
|
101
|
-
getUTF8String(file: ExternalAsset, uri?: string): string;
|
|
102
|
-
getBuffer(file: ExternalAsset, minStreamSize?: number): Promise<Buffer | null> | Buffer | null;
|
|
103
|
-
getCacheDir(url: string | URL, createDir?: boolean): string;
|
|
104
|
-
setAssetContent(file: ExternalAsset, content: string, options?: AssetContentOptions): string;
|
|
105
|
-
getAssetContent(file: ExternalAsset, content?: string): string | undefined;
|
|
106
|
-
writeBuffer(file: ExternalAsset, options?: WriteFileOptions): Buffer | null;
|
|
107
|
-
writeImage(document: string | string[], output: OutputFinalize<ExternalAsset>): boolean;
|
|
108
|
-
compressFile(file: ExternalAsset, overwrite?: boolean): Promise<unknown>;
|
|
109
|
-
fetchObject(uri: string | URL, format: BufferFormat): Promise<object | null>;
|
|
110
|
-
fetchObject(uri: string | URL, options?: OpenOptions): Promise<object | null>;
|
|
111
|
-
fetchBuffer(uri: string | URL, options?: OpenOptions): Promise<Buffer | string | null>;
|
|
112
|
-
fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
|
|
113
|
-
fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
114
|
-
updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
|
|
115
|
-
start(emptyDir?: boolean): Promise<FinalizeResult>;
|
|
116
|
-
processAssets(emptyDir?: boolean, using?: ExternalAsset[]): void;
|
|
117
|
-
deleteFile(src: string, promises: boolean): Promise<void>;
|
|
118
|
-
deleteFile(src: string, options: DeleteFileOptions & DeleteFileAddendum, promises: boolean): Promise<void>;
|
|
119
|
-
deleteFile(src: string, callback?: NoParamCallback): unknown;
|
|
120
|
-
deleteFile(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: NoParamCallback): unknown;
|
|
121
|
-
restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
|
|
122
|
-
restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
|
|
123
|
-
finalizeCompress(assets: ExternalAsset[]): Promise<void>;
|
|
124
|
-
finalizeDocument(): Promise<void>;
|
|
125
|
-
finalizeTask(assets: (ExternalAsset & Required<TaskAction>)[]): Promise<void>;
|
|
126
|
-
finalizeCloud(): Promise<void>;
|
|
127
|
-
finalizeChecksum(): Promise<void>;
|
|
128
|
-
finalizeCleanup(): Promise<void>;
|
|
129
|
-
finalize(): Promise<void>;
|
|
130
|
-
close(): void;
|
|
131
|
-
reset(): boolean;
|
|
132
|
-
get baseDirectory(): string;
|
|
133
|
-
get config(): RequestData;
|
|
134
|
-
get assets(): ExternalAsset[];
|
|
135
|
-
get incremental(): IncrementalMatch;
|
|
136
|
-
set restarting(value);
|
|
137
|
-
get restarting(): boolean;
|
|
138
|
-
get delayed(): number;
|
|
139
|
-
set cleared(value);
|
|
140
|
-
get cleared(): boolean;
|
|
141
|
-
set finalizeState(value);
|
|
142
|
-
get finalizeState(): number;
|
|
143
|
-
|
|
144
|
-
/* Set */
|
|
145
|
-
add(value: string, parent?: ExternalAsset, type?: number): this;
|
|
146
|
-
delete(value: string, emptyDir?: boolean): boolean;
|
|
147
|
-
has(value: unknown): value is string;
|
|
148
|
-
|
|
149
|
-
/* EventEmitter */
|
|
150
|
-
on(event: "end", listener: PostFinalizeCallback): this;
|
|
151
|
-
on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
152
|
-
on(event: "error", listener: (err: Error) => void): this;
|
|
153
|
-
on(event: "file:read", listener: (src: string, data: Buffer | string, options?: ReadFileOptions) => void): this;
|
|
154
|
-
on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
155
|
-
on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
156
|
-
on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
157
|
-
on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
158
|
-
on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
159
|
-
on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
160
|
-
once(event: "end", listener: PostFinalizeCallback): this;
|
|
161
|
-
once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
162
|
-
once(event: "error", listener: (err: Error) => void): this;
|
|
163
|
-
once(event: "file:read", listener: (src: string, data: Buffer | string, options?: ReadFileOptions) => void): this;
|
|
164
|
-
once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
165
|
-
once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
166
|
-
once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
167
|
-
once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
168
|
-
once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
169
|
-
once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
170
|
-
emit(event: "end", result: FinalizeResult): boolean;
|
|
171
|
-
emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
|
|
172
|
-
emit(event: "error", err: Error): boolean;
|
|
173
|
-
emit(event: "file:read", src: string, data: Buffer | string, options?: ReadFileOptions): boolean;
|
|
174
|
-
emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
|
|
175
|
-
emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
|
|
176
|
-
emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
|
|
177
|
-
emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
|
|
178
|
-
emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
|
|
179
|
-
emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
interface FileManagerConstructor extends HostConstructor {
|
|
183
|
-
purgeMemory(percent?: number, limit?: number | boolean, parent?: number | boolean): Promise<number>;
|
|
184
|
-
loadSettings(settings: Settings, password?: string): boolean;
|
|
185
|
-
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
186
|
-
sanitizeAssets(assets: ExternalAsset[], exclusions?: string[]): ExternalAsset[];
|
|
187
|
-
writeChecksum(root: string, options: ChecksumOptions): Promise<string[]>;
|
|
188
|
-
writeChecksum(root: string, to?: string, options?: ChecksumOptions): Promise<string[] | null>;
|
|
189
|
-
verifyChecksum(root: string, options: ChecksumOptions): Promise<[string[], string[], number] | null>;
|
|
190
|
-
verifyChecksum(root: string, from?: string, options?: ChecksumOptions): Promise<[string[], string[], number] | null>;
|
|
191
|
-
createFileThread(host: IFileManager, file: ExternalAsset): IFileThread;
|
|
192
|
-
setTimeout(options: Record<string, number | string>): void;
|
|
193
|
-
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
194
|
-
defineHttpConnect(options: HttpConnectSettings): void;
|
|
195
|
-
readonly prototype: IFileManager;
|
|
196
|
-
new(baseDirectory: string, config: RequestData, postFinalize?: PostFinalizeCallback): IFileManager;
|
|
197
|
-
new(baseDirectory: string, config: RequestData, permission?: IPermission | null, postFinalize?: PostFinalizeCallback): IFileManager;
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Settings
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
import type { BackgroundColor, ForegroundColor, LoggerProgress } from "./logger";
|
|
205
|
-
|
|
206
|
-
interface ProcessModule {
|
|
207
|
-
thread?: {
|
|
208
|
-
sub_limit?: number;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
interface RequestModule {
|
|
213
|
-
timeout?: number | string;
|
|
214
|
-
disk?: {
|
|
215
|
-
enabled?: boolean;
|
|
216
|
-
expires?: number | string;
|
|
217
|
-
limit?: number | string;
|
|
218
|
-
include?: string[];
|
|
219
|
-
exclude?: string[];
|
|
220
|
-
};
|
|
221
|
-
buffer?: {
|
|
222
|
-
enabled?: boolean;
|
|
223
|
-
expires?: number | string;
|
|
224
|
-
limit?: number | string;
|
|
225
|
-
include?: string[];
|
|
226
|
-
exclude?: string[];
|
|
227
|
-
limit_all?: number | string;
|
|
228
|
-
purge_amount?: number | string;
|
|
229
|
-
to_disk?: number | string | [number | string, (number | string)?];
|
|
230
|
-
};
|
|
231
|
-
connect?: {
|
|
232
|
-
timeout?: number | string;
|
|
233
|
-
retry_wait?: number | string;
|
|
234
|
-
retry_after?: number | string;
|
|
235
|
-
retry_limit?: number;
|
|
236
|
-
redirect_limit?: number;
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
interface ErrorModule {
|
|
241
|
-
recursion_limit?: number;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
interface LoggerModule {
|
|
245
|
-
progress?: LoggerProgress;
|
|
246
|
-
session_id?: boolean | number;
|
|
247
|
-
}
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Example usage
|
|
251
|
-
|
|
252
|
-
```javascript
|
|
253
|
-
const FileManager = require("@e-mc/file-manager");
|
|
254
|
-
|
|
255
|
-
FileManager.loadSettings({ // Global
|
|
256
|
-
process: {
|
|
257
|
-
thread: { sub_limit: 16 }
|
|
258
|
-
},
|
|
259
|
-
request: {
|
|
260
|
-
timeout: "15s",
|
|
261
|
-
disk: {
|
|
262
|
-
enabled: true,
|
|
263
|
-
limit: "1gb", // Content-Length
|
|
264
|
-
expires: "1d",
|
|
265
|
-
exclude: ["https://github.com", "zip"]
|
|
266
|
-
},
|
|
267
|
-
buffer: {
|
|
268
|
-
enabled: true,
|
|
269
|
-
limit: "64mb",
|
|
270
|
-
limit_all: "512mb",
|
|
271
|
-
expires: "1h",
|
|
272
|
-
purge_amount: 0.25 // When limit_all exceeded
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
permission: {
|
|
276
|
-
disk_read: ["**/*"],
|
|
277
|
-
disk_write: ["/tmp/**"]
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
const requestData = {
|
|
282
|
-
assets: [
|
|
283
|
-
{ uri: "http://hostname/path/document1.png" }, // /path/workspace/document1.png
|
|
284
|
-
{ pathname: "output", uri: "http://hostname/path/unknown", mimeType: "image/png" }, // /path/workspace/output/unknown.png
|
|
285
|
-
{ pathname: "output", filename: "image2.png", uri: "http://hostname/path/document2.png" } // /path/workspace/output/image2.png
|
|
286
|
-
],
|
|
287
|
-
incremental: "etag",
|
|
288
|
-
threads: 8,
|
|
289
|
-
log: {
|
|
290
|
-
showSize: true,
|
|
291
|
-
showProgress: true,
|
|
292
|
-
showDiff: [
|
|
293
|
-
"**/assets/*.js", // Local path
|
|
294
|
-
"javascript", // application/javascript | text/javascript
|
|
295
|
-
"text/css"
|
|
296
|
-
]
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
const instance = new FileManager("/path/workspace", requestData, { disk_write: ["/path/workspace/output/**"] });
|
|
301
|
-
await instance.start();
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-mc/core) and [Module](https://www.npmjs.com/package/@e-mc/module). Their ``loadSettings`` will be called as well which uses a combined [Settings](https://e-mc.readthedocs.io/en/latest/references.html#references-e-mc-types-lib-node) object.
|
|
305
|
-
|
|
306
|
-
## References
|
|
307
|
-
|
|
308
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
309
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
310
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
311
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
312
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
313
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
314
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
315
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
316
|
-
- https://www.unpkg.com/@e-mc/types@0.10.
|
|
317
|
-
|
|
318
|
-
* https://www.npmjs.com/package/@types/node
|
|
319
|
-
|
|
320
|
-
## LICENSE
|
|
321
|
-
|
|
1
|
+
# @e-mc/file-manager
|
|
2
|
+
|
|
3
|
+
* NodeJS 16
|
|
4
|
+
* ES2020
|
|
5
|
+
|
|
6
|
+
## General Usage
|
|
7
|
+
|
|
8
|
+
* [Read the Docs](https://e-mc.readthedocs.io)
|
|
9
|
+
|
|
10
|
+
## Interface
|
|
11
|
+
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.2/lib/index.d.ts)
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
16
|
+
|
|
17
|
+
import type { DocumentConstructor, HostConstructor, ICloud, ICompress, IDocument, IHost, IImage, IModule, IRequest, ITask, ImageConstructor, TaskConstructor, WatchInstance } from "./index";
|
|
18
|
+
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from "./asset";
|
|
19
|
+
import type { IPermission, PermissionReadWrite } from "./core";
|
|
20
|
+
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from "./filemanager";
|
|
21
|
+
import type { ExecCommand } from "./logger";
|
|
22
|
+
import type { CopyFileOptions, CreateDirOptions, DeleteFileOptions, MoveFileOptions, ReadFileOptions, RemoveDirOptions, WriteFileOptions } from "./module";
|
|
23
|
+
import type { RequestData, Settings } from "./node";
|
|
24
|
+
import type { Aria2Options, BufferFormat, OpenOptions } from "./request";
|
|
25
|
+
import type { CloudModule, CompressModule, DbModule, DocumentModule, HttpConnectSettings, HttpMemorySettings, ImageModule, RequestModule, TaskModule, WatchModule } from "./settings";
|
|
26
|
+
|
|
27
|
+
import type { SpawnOptions } from "child_process";
|
|
28
|
+
import type { NoParamCallback } from "fs";
|
|
29
|
+
|
|
30
|
+
interface IFileManager extends IHost, Set<string> {
|
|
31
|
+
processTimeout: number;
|
|
32
|
+
cacheToDisk: IHttpDiskCache<ExternalAsset>;
|
|
33
|
+
cacheToMemory: IHttpMemoryCache<ExternalAsset>;
|
|
34
|
+
Request: IRequest;
|
|
35
|
+
Document: InstallData<IDocument<IFileManager, ExternalAsset>, DocumentConstructor<IFileManager, ExternalAsset>>[];
|
|
36
|
+
Task: InstallData<ITask, TaskConstructor>[];
|
|
37
|
+
Image: Map<ImageMimeMap> | null;
|
|
38
|
+
Cloud: ICloud | null;
|
|
39
|
+
Watch: WatchInstance<ExternalAsset> | null;
|
|
40
|
+
Compress: ICompress | null;
|
|
41
|
+
readonly documentAssets: ExternalAsset[];
|
|
42
|
+
readonly taskAssets: (ExternalAsset & Required<TaskAction>)[];
|
|
43
|
+
readonly dataSourceItems: DataSource[];
|
|
44
|
+
readonly files: Set<string>;
|
|
45
|
+
readonly filesQueued: Set<string>;
|
|
46
|
+
readonly filesToRemove: Set<string>;
|
|
47
|
+
readonly filesToCompare: Map<ExternalAsset, string[]>;
|
|
48
|
+
readonly contentToAppend: Map<string, string[]>;
|
|
49
|
+
readonly contentToReplace: Map<string, string[]>;
|
|
50
|
+
readonly processing: IFileThread[];
|
|
51
|
+
readonly fetchedAssets: ExternalAsset[];
|
|
52
|
+
readonly copiedAssets: ExternalAsset[];
|
|
53
|
+
readonly emptyDir: Set<string>;
|
|
54
|
+
install(name: "document", handler: string, module?: DocumentModule, ...args: unknown[]): IDocument | undefined;
|
|
55
|
+
install(name: "document", target: DocumentConstructor, module?: DocumentModule, ...args: unknown[]): IDocument | undefined;
|
|
56
|
+
install(name: "task", handler: string, module?: TaskModule, ...args: unknown[]): ITask | undefined;
|
|
57
|
+
install(name: "task", target: TaskConstructor, module?: TaskModule, ...args: unknown[]): ITask | undefined;
|
|
58
|
+
install(name: "cloud", handler: string, module?: CloudModule, ...args: unknown[]): ICloud | undefined;
|
|
59
|
+
install(name: "cloud", module?: CloudModule, ...args: unknown[]): ICloud | undefined;
|
|
60
|
+
install(name: "image", handler: string, module?: ImageModule, ...args: unknown[]): IImage | undefined;
|
|
61
|
+
install(name: "image", target: ImageConstructor, module?: ImageModule, ...args: unknown[]): IImage | undefined;
|
|
62
|
+
install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
|
|
63
|
+
install(name: "watch", module: WatchModule): WatchInstance<ExternalAsset> | undefined;
|
|
64
|
+
install(name: "watch", interval?: number | string, port?: number | string, securePort?: number | string, extensions?: unknown[]): WatchInstance<ExternalAsset> | undefined;
|
|
65
|
+
install(name: "compress", module?: CompressModule): ICompress | undefined;
|
|
66
|
+
install(name: string, ...args: unknown[]): IModule | undefined;
|
|
67
|
+
using(...items: ExternalAsset[] | [boolean, ...ExternalAsset[]]): this;
|
|
68
|
+
contains(item: ExternalAsset, condition?: (target: ExternalAsset) => boolean): boolean;
|
|
69
|
+
removeCwd(value: unknown): string;
|
|
70
|
+
findAsset(value: string | URL, instance?: IModule | FindAssetOptions<ExternalAsset>): ExternalAsset | undefined;
|
|
71
|
+
removeAsset(file: ExternalAsset): boolean;
|
|
72
|
+
replace(file: ExternalAsset, replaceWith: string, mimeType: Undef<string>): boolean;
|
|
73
|
+
replace(file: ExternalAsset, replaceWith: string, options?: ReplaceOptions): boolean;
|
|
74
|
+
rename(file: ExternalAsset, value: string): boolean;
|
|
75
|
+
performAsyncTask(): void;
|
|
76
|
+
removeAsyncTask(): void;
|
|
77
|
+
completeAsyncTask(err?: unknown, uri?: string, parent?: ExternalAsset, type?: number): void;
|
|
78
|
+
performFinalize(override?: boolean): void;
|
|
79
|
+
hasDocument(instance: IModule, document: string | string[] | undefined): boolean;
|
|
80
|
+
getDocumentAssets(instance: IModule, condition?: (target: ExternalAsset) => boolean): ExternalAsset[];
|
|
81
|
+
getDataSourceItems(instance: IModule, condition?: (target: DataSource) => boolean): DataSource[];
|
|
82
|
+
checkFilename(file: ExternalAsset, pathname?: string): string;
|
|
83
|
+
setLocalUri(file: ExternalAsset, replace?: boolean): FileOutput;
|
|
84
|
+
getLocalUri(data: FileData<ExternalAsset>): string;
|
|
85
|
+
getMimeType(data: FileData<ExternalAsset>): string;
|
|
86
|
+
openThread(instance: IModule, data: IFileThread, timeout?: number): boolean;
|
|
87
|
+
closeThread(instance: IModule | null, data: IFileThread, callback?: (...args: unknown[]) => void): boolean;
|
|
88
|
+
addProcessTimeout(instance: IModule, file: ExternalAsset, timeout: number): void;
|
|
89
|
+
removeProcessTimeout(instance: IModule, file: ExternalAsset): void;
|
|
90
|
+
getProcessTimeout(handler: InstallData): number;
|
|
91
|
+
clearProcessTimeout(): void;
|
|
92
|
+
scheduleTask(url: string | URL, data: unknown, priority: number): Promise<unknown>;
|
|
93
|
+
scheduleTask(url: string | URL, data: unknown, thenCallback?: (...args: unknown[]) => unknown, catchCallback?: (...args: unknown[]) => unknown, priority?: number): Promise<unknown>;
|
|
94
|
+
setTaskLimit(value: number): void;
|
|
95
|
+
addDownload(value: number | Buffer | string, encoding: BufferEncoding): number;
|
|
96
|
+
addDownload(value: number | Buffer | string, type?: number | BufferEncoding, encoding?: BufferEncoding): number;
|
|
97
|
+
getDownload(type?: number): [number, number];
|
|
98
|
+
transformAsset(data: IFileThread, parent?: ExternalAsset, override?: boolean): Promise<boolean>;
|
|
99
|
+
addCopy(data: FileCommand<ExternalAsset>, saveAs?: string, replace?: boolean): string | undefined;
|
|
100
|
+
findMime(file: ExternalAsset, rename?: boolean): Promise<string>;
|
|
101
|
+
getUTF8String(file: ExternalAsset, uri?: string): string;
|
|
102
|
+
getBuffer(file: ExternalAsset, minStreamSize?: number): Promise<Buffer | null> | Buffer | null;
|
|
103
|
+
getCacheDir(url: string | URL, createDir?: boolean): string;
|
|
104
|
+
setAssetContent(file: ExternalAsset, content: string, options?: AssetContentOptions): string;
|
|
105
|
+
getAssetContent(file: ExternalAsset, content?: string): string | undefined;
|
|
106
|
+
writeBuffer(file: ExternalAsset, options?: WriteFileOptions): Buffer | null;
|
|
107
|
+
writeImage(document: string | string[], output: OutputFinalize<ExternalAsset>): boolean;
|
|
108
|
+
compressFile(file: ExternalAsset, overwrite?: boolean): Promise<unknown>;
|
|
109
|
+
fetchObject(uri: string | URL, format: BufferFormat): Promise<object | null>;
|
|
110
|
+
fetchObject(uri: string | URL, options?: OpenOptions): Promise<object | null>;
|
|
111
|
+
fetchBuffer(uri: string | URL, options?: OpenOptions): Promise<Buffer | string | null>;
|
|
112
|
+
fetchFiles(uri: string | URL, pathname: string): Promise<string[]>;
|
|
113
|
+
fetchFiles(uri: string | URL, options?: Aria2Options): Promise<string[]>;
|
|
114
|
+
updateProgress(name: "request", id: number | string, receivedBytes: number, totalBytes: number, dataTime?: HighResolutionTime): void;
|
|
115
|
+
start(emptyDir?: boolean): Promise<FinalizeResult>;
|
|
116
|
+
processAssets(emptyDir?: boolean, using?: ExternalAsset[]): void;
|
|
117
|
+
deleteFile(src: string, promises: boolean): Promise<void>;
|
|
118
|
+
deleteFile(src: string, options: DeleteFileOptions & DeleteFileAddendum, promises: boolean): Promise<void>;
|
|
119
|
+
deleteFile(src: string, callback?: NoParamCallback): unknown;
|
|
120
|
+
deleteFile(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: NoParamCallback): unknown;
|
|
121
|
+
restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
|
|
122
|
+
restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
|
|
123
|
+
finalizeCompress(assets: ExternalAsset[]): Promise<void>;
|
|
124
|
+
finalizeDocument(): Promise<void>;
|
|
125
|
+
finalizeTask(assets: (ExternalAsset & Required<TaskAction>)[]): Promise<void>;
|
|
126
|
+
finalizeCloud(): Promise<void>;
|
|
127
|
+
finalizeChecksum(): Promise<void>;
|
|
128
|
+
finalizeCleanup(): Promise<void>;
|
|
129
|
+
finalize(): Promise<void>;
|
|
130
|
+
close(): void;
|
|
131
|
+
reset(): boolean;
|
|
132
|
+
get baseDirectory(): string;
|
|
133
|
+
get config(): RequestData;
|
|
134
|
+
get assets(): ExternalAsset[];
|
|
135
|
+
get incremental(): IncrementalMatch;
|
|
136
|
+
set restarting(value);
|
|
137
|
+
get restarting(): boolean;
|
|
138
|
+
get delayed(): number;
|
|
139
|
+
set cleared(value);
|
|
140
|
+
get cleared(): boolean;
|
|
141
|
+
set finalizeState(value);
|
|
142
|
+
get finalizeState(): number;
|
|
143
|
+
|
|
144
|
+
/* Set */
|
|
145
|
+
add(value: string, parent?: ExternalAsset, type?: number): this;
|
|
146
|
+
delete(value: string, emptyDir?: boolean): boolean;
|
|
147
|
+
has(value: unknown): value is string;
|
|
148
|
+
|
|
149
|
+
/* EventEmitter */
|
|
150
|
+
on(event: "end", listener: PostFinalizeCallback): this;
|
|
151
|
+
on(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
152
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
153
|
+
on(event: "file:read", listener: (src: string, data: Buffer | string, options?: ReadFileOptions) => void): this;
|
|
154
|
+
on(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
155
|
+
on(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
156
|
+
on(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
157
|
+
on(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
158
|
+
on(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
159
|
+
on(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
160
|
+
once(event: "end", listener: PostFinalizeCallback): this;
|
|
161
|
+
once(event: "exec", listener: (command: ExecCommand, options?: SpawnOptions) => void): this;
|
|
162
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
163
|
+
once(event: "file:read", listener: (src: string, data: Buffer | string, options?: ReadFileOptions) => void): this;
|
|
164
|
+
once(event: "file:write", listener: (src: string, options?: WriteFileOptions) => void): this;
|
|
165
|
+
once(event: "file:delete", listener: (src: string, options?: DeleteFileOptions) => void): this;
|
|
166
|
+
once(event: "file:copy", listener: (dest: string, options?: CopyFileOptions) => void): this;
|
|
167
|
+
once(event: "file:move", listener: (dest: string, options?: MoveFileOptions) => void): this;
|
|
168
|
+
once(event: "dir:create", listener: (src: string, options?: CreateDirOptions) => void): this;
|
|
169
|
+
once(event: "dir:remove", listener: (src: string, options?: RemoveDirOptions) => void): this;
|
|
170
|
+
emit(event: "end", result: FinalizeResult): boolean;
|
|
171
|
+
emit(event: "exec", command: ExecCommand, options?: SpawnOptions): boolean;
|
|
172
|
+
emit(event: "error", err: Error): boolean;
|
|
173
|
+
emit(event: "file:read", src: string, data: Buffer | string, options?: ReadFileOptions): boolean;
|
|
174
|
+
emit(event: "file:write", src: string, options?: WriteFileOptions): boolean;
|
|
175
|
+
emit(event: "file:delete", src: string, options?: DeleteFileOptions): boolean;
|
|
176
|
+
emit(event: "file:copy", dest: string, options?: CopyFileOptions): boolean;
|
|
177
|
+
emit(event: "file:move", dest: string, options?: MoveFileOptions): boolean;
|
|
178
|
+
emit(event: "dir:create", src: string, options?: CreateDirOptions): boolean;
|
|
179
|
+
emit(event: "dir:remove", src: string, options?: RemoveDirOptions): boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface FileManagerConstructor extends HostConstructor {
|
|
183
|
+
purgeMemory(percent?: number, limit?: number | boolean, parent?: number | boolean): Promise<number>;
|
|
184
|
+
loadSettings(settings: Settings, password?: string): boolean;
|
|
185
|
+
loadSettings(settings: Settings, permission?: PermissionReadWrite, password?: string): boolean;
|
|
186
|
+
sanitizeAssets(assets: ExternalAsset[], exclusions?: string[]): ExternalAsset[];
|
|
187
|
+
writeChecksum(root: string, options: ChecksumOptions): Promise<string[]>;
|
|
188
|
+
writeChecksum(root: string, to?: string, options?: ChecksumOptions): Promise<string[] | null>;
|
|
189
|
+
verifyChecksum(root: string, options: ChecksumOptions): Promise<[string[], string[], number] | null>;
|
|
190
|
+
verifyChecksum(root: string, from?: string, options?: ChecksumOptions): Promise<[string[], string[], number] | null>;
|
|
191
|
+
createFileThread(host: IFileManager, file: ExternalAsset): IFileThread;
|
|
192
|
+
setTimeout(options: Record<string, number | string>): void;
|
|
193
|
+
defineHttpCache(options: HttpMemorySettings, disk?: boolean): void;
|
|
194
|
+
defineHttpConnect(options: HttpConnectSettings): void;
|
|
195
|
+
readonly prototype: IFileManager;
|
|
196
|
+
new(baseDirectory: string, config: RequestData, postFinalize?: PostFinalizeCallback): IFileManager;
|
|
197
|
+
new(baseDirectory: string, config: RequestData, permission?: IPermission | null, postFinalize?: PostFinalizeCallback): IFileManager;
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Settings
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import type { BackgroundColor, ForegroundColor, LoggerProgress } from "./logger";
|
|
205
|
+
|
|
206
|
+
interface ProcessModule {
|
|
207
|
+
thread?: {
|
|
208
|
+
sub_limit?: number;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface RequestModule {
|
|
213
|
+
timeout?: number | string;
|
|
214
|
+
disk?: {
|
|
215
|
+
enabled?: boolean;
|
|
216
|
+
expires?: number | string;
|
|
217
|
+
limit?: number | string;
|
|
218
|
+
include?: string[];
|
|
219
|
+
exclude?: string[];
|
|
220
|
+
};
|
|
221
|
+
buffer?: {
|
|
222
|
+
enabled?: boolean;
|
|
223
|
+
expires?: number | string;
|
|
224
|
+
limit?: number | string;
|
|
225
|
+
include?: string[];
|
|
226
|
+
exclude?: string[];
|
|
227
|
+
limit_all?: number | string;
|
|
228
|
+
purge_amount?: number | string;
|
|
229
|
+
to_disk?: number | string | [number | string, (number | string)?];
|
|
230
|
+
};
|
|
231
|
+
connect?: {
|
|
232
|
+
timeout?: number | string;
|
|
233
|
+
retry_wait?: number | string;
|
|
234
|
+
retry_after?: number | string;
|
|
235
|
+
retry_limit?: number;
|
|
236
|
+
redirect_limit?: number;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface ErrorModule {
|
|
241
|
+
recursion_limit?: number;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface LoggerModule {
|
|
245
|
+
progress?: LoggerProgress;
|
|
246
|
+
session_id?: boolean | number;
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Example usage
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
const FileManager = require("@e-mc/file-manager");
|
|
254
|
+
|
|
255
|
+
FileManager.loadSettings({ // Global
|
|
256
|
+
process: {
|
|
257
|
+
thread: { sub_limit: 16 }
|
|
258
|
+
},
|
|
259
|
+
request: {
|
|
260
|
+
timeout: "15s",
|
|
261
|
+
disk: {
|
|
262
|
+
enabled: true,
|
|
263
|
+
limit: "1gb", // Content-Length
|
|
264
|
+
expires: "1d",
|
|
265
|
+
exclude: ["https://github.com", "zip"]
|
|
266
|
+
},
|
|
267
|
+
buffer: {
|
|
268
|
+
enabled: true,
|
|
269
|
+
limit: "64mb",
|
|
270
|
+
limit_all: "512mb",
|
|
271
|
+
expires: "1h",
|
|
272
|
+
purge_amount: 0.25 // When limit_all exceeded
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
permission: {
|
|
276
|
+
disk_read: ["**/*"],
|
|
277
|
+
disk_write: ["/tmp/**"]
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
const requestData = {
|
|
282
|
+
assets: [
|
|
283
|
+
{ uri: "http://hostname/path/document1.png" }, // /path/workspace/document1.png
|
|
284
|
+
{ pathname: "output", uri: "http://hostname/path/unknown", mimeType: "image/png" }, // /path/workspace/output/unknown.png
|
|
285
|
+
{ pathname: "output", filename: "image2.png", uri: "http://hostname/path/document2.png" } // /path/workspace/output/image2.png
|
|
286
|
+
],
|
|
287
|
+
incremental: "etag",
|
|
288
|
+
threads: 8,
|
|
289
|
+
log: {
|
|
290
|
+
showSize: true,
|
|
291
|
+
showProgress: true,
|
|
292
|
+
showDiff: [
|
|
293
|
+
"**/assets/*.js", // Local path
|
|
294
|
+
"javascript", // application/javascript | text/javascript
|
|
295
|
+
"text/css"
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const instance = new FileManager("/path/workspace", requestData, { disk_write: ["/path/workspace/output/**"] });
|
|
301
|
+
await instance.start();
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-mc/core) and [Module](https://www.npmjs.com/package/@e-mc/module). Their ``loadSettings`` will be called as well which uses a combined [Settings](https://e-mc.readthedocs.io/en/latest/references.html#references-e-mc-types-lib-node) object.
|
|
305
|
+
|
|
306
|
+
## References
|
|
307
|
+
|
|
308
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/squared.d.ts
|
|
309
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/asset.d.ts
|
|
310
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/core.d.ts
|
|
311
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/filemanager.d.ts
|
|
312
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/logger.d.ts
|
|
313
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/module.d.ts
|
|
314
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/node.d.ts
|
|
315
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/request.d.ts
|
|
316
|
+
- https://www.unpkg.com/@e-mc/types@0.10.2/lib/settings.d.ts
|
|
317
|
+
|
|
318
|
+
* https://www.npmjs.com/package/@types/node
|
|
319
|
+
|
|
320
|
+
## LICENSE
|
|
321
|
+
|
|
322
322
|
BSD 3-Clause
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FileManagerConstructor } from '../types/lib';
|
|
2
|
-
import type { ExternalAsset } from '../types/lib/asset';
|
|
3
|
-
|
|
4
|
-
declare const FileManager: FileManagerConstructor<ExternalAsset>;
|
|
5
|
-
|
|
1
|
+
import type { FileManagerConstructor } from '../types/lib';
|
|
2
|
+
import type { ExternalAsset } from '../types/lib/asset';
|
|
3
|
+
|
|
4
|
+
declare const FileManager: FileManagerConstructor<ExternalAsset>;
|
|
5
|
+
|
|
6
6
|
export = FileManager;
|
package/index.js
CHANGED
|
@@ -195,7 +195,7 @@ function checkHash(host, localUri, output, options, data) {
|
|
|
195
195
|
value = options;
|
|
196
196
|
}
|
|
197
197
|
if ((0, types_1.isString)(value)) {
|
|
198
|
-
algorithm
|
|
198
|
+
algorithm ||= "sha256";
|
|
199
199
|
if (!data && localUri) {
|
|
200
200
|
try {
|
|
201
201
|
data = fs.readFileSync(localUri);
|
|
@@ -488,7 +488,7 @@ function nextScheduled(scheduler, pid) {
|
|
|
488
488
|
if (pid > 0) {
|
|
489
489
|
const found = scheduler.status.find(item => item.id === pid);
|
|
490
490
|
if (found) {
|
|
491
|
-
found.endTime
|
|
491
|
+
found.endTime ||= Date.now();
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
--scheduler.count;
|
|
@@ -509,12 +509,12 @@ async function doVerifyChecksum(root, from, options, nested) {
|
|
|
509
509
|
from = undefined;
|
|
510
510
|
}
|
|
511
511
|
else {
|
|
512
|
-
options
|
|
512
|
+
options ||= {};
|
|
513
513
|
}
|
|
514
514
|
const { digest, sortBy = 0, recursive = false, ignore = [], include, exclude, verbose = true, joinRoot } = options;
|
|
515
515
|
const parent = recursive === 1 && typeof verbose !== 'number';
|
|
516
516
|
let algorithm = options.algorithm;
|
|
517
|
-
from
|
|
517
|
+
from ||= checksumFile(algorithm);
|
|
518
518
|
if (!algorithm) {
|
|
519
519
|
switch (algorithm = path.extname(from).substring(1).toLowerCase()) {
|
|
520
520
|
case 'md5':
|
|
@@ -1030,22 +1030,21 @@ class ProcessFile {
|
|
|
1030
1030
|
return true;
|
|
1031
1031
|
}
|
|
1032
1032
|
queued(pathname, emptyDir, content) {
|
|
1033
|
-
var _p, _q, _r;
|
|
1034
1033
|
if (!this.createFolder(pathname, emptyDir)) {
|
|
1035
1034
|
return true;
|
|
1036
1035
|
}
|
|
1037
1036
|
const { host, groupData: group, file, localUri } = this;
|
|
1038
1037
|
const { bundleId, bundleIndex = -1 } = file;
|
|
1039
1038
|
if (!(0, types_1.isEmpty)(bundleId) && bundleIndex >= 0) {
|
|
1040
|
-
const items =
|
|
1041
|
-
|
|
1039
|
+
const items = group.appending[localUri] ||= [];
|
|
1040
|
+
group.bundling[file.uri] ||= [];
|
|
1042
1041
|
if (bundleIndex > 0) {
|
|
1043
1042
|
items[bundleIndex - 1] = file;
|
|
1044
1043
|
const url = file.url;
|
|
1045
1044
|
if (file.fetchType === 1 && (host.cacheToDisk.has(url) || host.cacheToMemory.has(url))) {
|
|
1046
1045
|
const parent = host.assets.find(item => item.bundleIndex === 0 && item.bundleId === bundleId);
|
|
1047
1046
|
if (parent) {
|
|
1048
|
-
(parent.bundleQueue
|
|
1047
|
+
(parent.bundleQueue ||= []).push(new Promise(resolve => {
|
|
1049
1048
|
host.Request.open(url, { method: 'HEAD', httpVersion: 1 })
|
|
1050
1049
|
.on('response', res => {
|
|
1051
1050
|
if (res.statusCode < 300) {
|
|
@@ -1134,7 +1133,7 @@ class ProcessFile {
|
|
|
1134
1133
|
else {
|
|
1135
1134
|
const tasks = [];
|
|
1136
1135
|
for (const queue of items) {
|
|
1137
|
-
const encoding = queue.encoding
|
|
1136
|
+
const encoding = queue.encoding ||= 'utf-8';
|
|
1138
1137
|
const { uri, fetchType: type } = queue;
|
|
1139
1138
|
let tempFile;
|
|
1140
1139
|
if (checkEtag && queue.trailingContent) {
|
|
@@ -1403,7 +1402,7 @@ class FileThread extends core_1.AbortComponent {
|
|
|
1403
1402
|
}
|
|
1404
1403
|
getObject(data) {
|
|
1405
1404
|
const result = { ...data, file: this.file };
|
|
1406
|
-
result.mimeType
|
|
1405
|
+
result.mimeType ||= this.mimeType;
|
|
1407
1406
|
return result;
|
|
1408
1407
|
}
|
|
1409
1408
|
get host() {
|
|
@@ -1601,10 +1600,10 @@ class FileManager extends core_1.Host {
|
|
|
1601
1600
|
to = undefined;
|
|
1602
1601
|
}
|
|
1603
1602
|
else {
|
|
1604
|
-
options
|
|
1603
|
+
options ||= {};
|
|
1605
1604
|
}
|
|
1606
1605
|
const { algorithm, digest, sortBy = 0, recursive = false, ignore = [], include, exclude, verbose = false, joinRoot } = options;
|
|
1607
|
-
to
|
|
1606
|
+
to ||= checksumFile(algorithm);
|
|
1608
1607
|
let result = [];
|
|
1609
1608
|
try {
|
|
1610
1609
|
const filename = path.basename(to);
|
|
@@ -1756,9 +1755,9 @@ class FileManager extends core_1.Host {
|
|
|
1756
1755
|
item.encoding = encoding.endsWith('be') ? undefined : (0, types_1.getEncoding)(encoding);
|
|
1757
1756
|
}
|
|
1758
1757
|
if ((0, types_1.usingFlag)(item.flags)) {
|
|
1759
|
-
(targeted
|
|
1758
|
+
(targeted ||= []).push(item);
|
|
1760
1759
|
}
|
|
1761
|
-
item.id
|
|
1760
|
+
item.id ||= ++ASSET_ID;
|
|
1762
1761
|
}
|
|
1763
1762
|
this._assets = assets.slice(0);
|
|
1764
1763
|
this[kIncremental] = incremental === "staging" ? "staging" : "none";
|
|
@@ -2147,7 +2146,7 @@ class FileManager extends core_1.Host {
|
|
|
2147
2146
|
}
|
|
2148
2147
|
}
|
|
2149
2148
|
else if (isFunction(Target = tryPackage(this, Target, 2048)) && Target.prototype instanceof image_1) {
|
|
2150
|
-
return createImageInstance(this, this.Image
|
|
2149
|
+
return createImageInstance(this, this.Image ??= new Map(), 'handler', Target, ...args);
|
|
2151
2150
|
}
|
|
2152
2151
|
break;
|
|
2153
2152
|
}
|
|
@@ -2320,7 +2319,7 @@ class FileManager extends core_1.Host {
|
|
|
2320
2319
|
if (localUri && !this.assets.find(item => item.localUri === localUri && !item.invalid)) {
|
|
2321
2320
|
this.filesToRemove.add(localUri);
|
|
2322
2321
|
}
|
|
2323
|
-
(this[kReplaceMap]
|
|
2322
|
+
(this[kReplaceMap] ||= {})[core_1.Host.joinPath(file.pathname, file.filename)] = file;
|
|
2324
2323
|
}
|
|
2325
2324
|
}
|
|
2326
2325
|
unsetContent(file);
|
|
@@ -2551,7 +2550,7 @@ class FileManager extends core_1.Host {
|
|
|
2551
2550
|
return data.file.localUri || '';
|
|
2552
2551
|
}
|
|
2553
2552
|
getMimeType(data) {
|
|
2554
|
-
return data.mimeType
|
|
2553
|
+
return data.mimeType ||= data.file.mimeType || core_1.Host.lookupMime(path.basename(this.getLocalUri(data)));
|
|
2555
2554
|
}
|
|
2556
2555
|
getDocumentAssets(instance, condition) {
|
|
2557
2556
|
return this.documentAssets.filter(item => this.hasDocument(instance, item.document) && (!condition || condition(item)));
|
|
@@ -2567,7 +2566,7 @@ class FileManager extends core_1.Host {
|
|
|
2567
2566
|
sourceUTF8 = file.buffer.toString(file.encoding);
|
|
2568
2567
|
file.buffer = null;
|
|
2569
2568
|
}
|
|
2570
|
-
else if (uri
|
|
2569
|
+
else if (uri ||= file.localUri) {
|
|
2571
2570
|
try {
|
|
2572
2571
|
sourceUTF8 = fs.readFileSync(uri, file.encoding);
|
|
2573
2572
|
}
|
|
@@ -2659,7 +2658,7 @@ class FileManager extends core_1.Host {
|
|
|
2659
2658
|
return content;
|
|
2660
2659
|
}
|
|
2661
2660
|
let replacing, newline;
|
|
2662
|
-
const getSeparator = (value) => newline
|
|
2661
|
+
const getSeparator = (value) => newline ||= (0, util_1.getNewline)(value);
|
|
2663
2662
|
if (content && (replacing = this.contentToReplace.get(localUri)) && replacing.length > 0) {
|
|
2664
2663
|
for (let i = 0, value, match; i < replacing.length; ++i) {
|
|
2665
2664
|
if ((0, types_1.isString)(value = appending[i])) {
|
|
@@ -2687,7 +2686,7 @@ class FileManager extends core_1.Host {
|
|
|
2687
2686
|
return (content || '') + appending.reduce((a, b) => b ? a + getSeparator(b) + b : a, '');
|
|
2688
2687
|
}
|
|
2689
2688
|
writeBuffer(file, options) {
|
|
2690
|
-
const buffer = file.sourceUTF8 ? Buffer.from(file.sourceUTF8, file.encoding
|
|
2689
|
+
const buffer = file.sourceUTF8 ? Buffer.from(file.sourceUTF8, file.encoding ||= 'utf-8') : file.buffer;
|
|
2691
2690
|
const localUri = file.localUri;
|
|
2692
2691
|
if (buffer && localUri) {
|
|
2693
2692
|
try {
|
|
@@ -2701,7 +2700,7 @@ class FileManager extends core_1.Host {
|
|
|
2701
2700
|
return null;
|
|
2702
2701
|
}
|
|
2703
2702
|
writeImage(document, output) {
|
|
2704
|
-
output.baseDirectory
|
|
2703
|
+
output.baseDirectory ||= this.baseDirectory;
|
|
2705
2704
|
for (const { instance } of this.Document) {
|
|
2706
2705
|
if (instance.writeImage && this.hasDocument(instance, document) && instance.writeImage(output)) {
|
|
2707
2706
|
return true;
|
|
@@ -2717,7 +2716,7 @@ class FileManager extends core_1.Host {
|
|
|
2717
2716
|
const document = data.file.document;
|
|
2718
2717
|
const ext = path.extname(localUri).substring(1);
|
|
2719
2718
|
let output;
|
|
2720
|
-
saveAs
|
|
2719
|
+
saveAs ||= ext;
|
|
2721
2720
|
if (document) {
|
|
2722
2721
|
for (const { instance } of this.Document) {
|
|
2723
2722
|
if (instance.addCopy && this.hasDocument(instance, document) && (output = instance.addCopy(data, saveAs, replace))) {
|
|
@@ -2750,7 +2749,7 @@ class FileManager extends core_1.Host {
|
|
|
2750
2749
|
}
|
|
2751
2750
|
} while (this.filesQueued.has(output) && ++i);
|
|
2752
2751
|
}
|
|
2753
|
-
this.filesQueued.add(output
|
|
2752
|
+
this.filesQueued.add(output ||= localUri);
|
|
2754
2753
|
return output;
|
|
2755
2754
|
}
|
|
2756
2755
|
async findMime(file, rename) {
|
|
@@ -2803,7 +2802,7 @@ class FileManager extends core_1.Host {
|
|
|
2803
2802
|
let output;
|
|
2804
2803
|
switch (format) {
|
|
2805
2804
|
case 'br':
|
|
2806
|
-
options.mimeType
|
|
2805
|
+
options.mimeType ||= file.mimeType;
|
|
2807
2806
|
case 'gz':
|
|
2808
2807
|
output = localUri + '.' + format;
|
|
2809
2808
|
break;
|
|
@@ -3003,7 +3002,7 @@ class FileManager extends core_1.Host {
|
|
|
3003
3002
|
}
|
|
3004
3003
|
addProcessTimeout(instance, file, timeout) {
|
|
3005
3004
|
if (timeout > 0) {
|
|
3006
|
-
const processModule = file.processModule
|
|
3005
|
+
const processModule = file.processModule ||= {};
|
|
3007
3006
|
const current = processModule[instance.moduleName];
|
|
3008
3007
|
if (current) {
|
|
3009
3008
|
current.timeout += timeout;
|
|
@@ -3068,7 +3067,7 @@ class FileManager extends core_1.Host {
|
|
|
3068
3067
|
if (typeof options === 'string') {
|
|
3069
3068
|
options = { format: options };
|
|
3070
3069
|
}
|
|
3071
|
-
options.format
|
|
3070
|
+
options.format ||= 'json';
|
|
3072
3071
|
return this.Request.get(uri, options).then(data => typeof data === 'object' ? data : null);
|
|
3073
3072
|
}
|
|
3074
3073
|
async fetchBuffer(uri, options) {
|
|
@@ -3093,7 +3092,7 @@ class FileManager extends core_1.Host {
|
|
|
3093
3092
|
if (typeof options === 'string') {
|
|
3094
3093
|
options = { pathname: options };
|
|
3095
3094
|
}
|
|
3096
|
-
options.pathname
|
|
3095
|
+
options.pathname ||= this.baseDirectory;
|
|
3097
3096
|
return this.Request.aria2c(uri, options);
|
|
3098
3097
|
}
|
|
3099
3098
|
async start(emptyDir) {
|
|
@@ -3144,7 +3143,7 @@ class FileManager extends core_1.Host {
|
|
|
3144
3143
|
resetAssets(this);
|
|
3145
3144
|
break;
|
|
3146
3145
|
}
|
|
3147
|
-
return this._pendingResult
|
|
3146
|
+
return this._pendingResult ||= new Promise((resolve, reject) => {
|
|
3148
3147
|
this.on('end', listener(resolve));
|
|
3149
3148
|
try {
|
|
3150
3149
|
this.processAssets(emptyDir);
|
|
@@ -3153,10 +3152,9 @@ class FileManager extends core_1.Host {
|
|
|
3153
3152
|
this.done = true;
|
|
3154
3153
|
reject(err);
|
|
3155
3154
|
}
|
|
3156
|
-
})
|
|
3155
|
+
});
|
|
3157
3156
|
}
|
|
3158
3157
|
processAssets(emptyDir = false, targeted) {
|
|
3159
|
-
var _p;
|
|
3160
3158
|
if (this.aborted) {
|
|
3161
3159
|
abortedHost(this);
|
|
3162
3160
|
return;
|
|
@@ -3434,7 +3432,7 @@ class FileManager extends core_1.Host {
|
|
|
3434
3432
|
if (diffSource && core_1.Host.isPath(localUri, true) && diffSource[0].some(pattern => typeof pattern === 'string' ? pattern === item.mimeType || pattern === item.mimeType?.split('/')[1] : pattern(localUri))) {
|
|
3435
3433
|
try {
|
|
3436
3434
|
const encoding = image_1.isBinary(item.mimeType) ? 'base64' : item.encoding || 'utf-8';
|
|
3437
|
-
|
|
3435
|
+
diffSource[1][localUri] ||= [fs.readFileSync(localUri, encoding), encoding];
|
|
3438
3436
|
}
|
|
3439
3437
|
catch (err) {
|
|
3440
3438
|
this.formatMessage(32, "WARN!", ["Unable to read file", path.basename(localUri)], err, { ...core_1.Host.LOG_STYLE_WARN });
|
|
@@ -3445,7 +3443,7 @@ class FileManager extends core_1.Host {
|
|
|
3445
3443
|
const content = item.content;
|
|
3446
3444
|
item.sourceUTF8 = content;
|
|
3447
3445
|
this.performAsyncTask();
|
|
3448
|
-
fs.writeFile(localUri, content, item.encoding
|
|
3446
|
+
fs.writeFile(localUri, content, item.encoding ||= 'utf-8', err => {
|
|
3449
3447
|
target.received(err, incremental);
|
|
3450
3448
|
});
|
|
3451
3449
|
}
|
|
@@ -3736,7 +3734,7 @@ class FileManager extends core_1.Host {
|
|
|
3736
3734
|
target.abort((0, types_1.errorValue)("No files were successfully downloaded", uri));
|
|
3737
3735
|
}
|
|
3738
3736
|
else if (bundleMain) {
|
|
3739
|
-
const encoding = item.encoding
|
|
3737
|
+
const encoding = item.encoding ||= 'utf-8';
|
|
3740
3738
|
fs.writeFile(localUri, bundleTorrent(this, result, item.mimeType, encoding), encoding, err => {
|
|
3741
3739
|
if (!err) {
|
|
3742
3740
|
fetchedAssets.push(item);
|
|
@@ -4118,7 +4116,7 @@ class FileManager extends core_1.Host {
|
|
|
4118
4116
|
for (let i = 0, length = output.length, buffer = null; i < length; ++i) {
|
|
4119
4117
|
const options = output[i];
|
|
4120
4118
|
options.mimeType = mimeType;
|
|
4121
|
-
options.timeout
|
|
4119
|
+
options.timeout ??= this[kProcessTimeout].compress ?? PROCESS_TIMEOUT.compress;
|
|
4122
4120
|
await compress.tryImage(buffer || files.length === 1 && item.buffer || file, file, options)
|
|
4123
4121
|
.then(result => {
|
|
4124
4122
|
if (result) {
|
|
@@ -4262,7 +4260,7 @@ class FileManager extends core_1.Host {
|
|
|
4262
4260
|
for (const item of this.assets) {
|
|
4263
4261
|
if (item.sourceUTF8 && !ignoreAsset(item)) {
|
|
4264
4262
|
try {
|
|
4265
|
-
fs.writeFileSync(item.localUri, item.sourceUTF8, item.encoding
|
|
4263
|
+
fs.writeFileSync(item.localUri, item.sourceUTF8, item.encoding ||= 'utf-8');
|
|
4266
4264
|
}
|
|
4267
4265
|
catch (err) {
|
|
4268
4266
|
this.writeFail(["Unable to write file", path.basename(item.localUri)], err, { type: 32, startTime });
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.10.
|
|
4
|
-
"description": "FileManager constructor for E-mc.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
|
-
"directory": "src/file-manager"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"squared",
|
|
17
|
-
"squared-functions"
|
|
18
|
-
],
|
|
19
|
-
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
-
"license": "BSD 3-Clause",
|
|
21
|
-
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "0.10.
|
|
24
|
-
"@e-mc/compress": "0.10.
|
|
25
|
-
"@e-mc/core": "0.10.
|
|
26
|
-
"@e-mc/document": "0.10.
|
|
27
|
-
"@e-mc/image": "0.10.
|
|
28
|
-
"@e-mc/request": "0.10.
|
|
29
|
-
"@e-mc/task": "0.10.
|
|
30
|
-
"@e-mc/types": "0.10.
|
|
31
|
-
"@e-mc/watch": "0.10.
|
|
32
|
-
"chalk": "4.1.2",
|
|
33
|
-
"diff": "^5.2.0",
|
|
34
|
-
"picomatch": "^4.0.2",
|
|
35
|
-
"strip-ansi": "6.0.1"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@e-mc/file-manager",
|
|
3
|
+
"version": "0.10.2",
|
|
4
|
+
"description": "FileManager constructor for E-mc.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/anpham6/e-mc.git",
|
|
13
|
+
"directory": "src/file-manager"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"squared",
|
|
17
|
+
"squared-functions"
|
|
18
|
+
],
|
|
19
|
+
"author": "An Pham <anpham6@gmail.com>",
|
|
20
|
+
"license": "BSD 3-Clause",
|
|
21
|
+
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@e-mc/cloud": "0.10.2",
|
|
24
|
+
"@e-mc/compress": "0.10.2",
|
|
25
|
+
"@e-mc/core": "0.10.2",
|
|
26
|
+
"@e-mc/document": "0.10.2",
|
|
27
|
+
"@e-mc/image": "0.10.2",
|
|
28
|
+
"@e-mc/request": "0.10.2",
|
|
29
|
+
"@e-mc/task": "0.10.2",
|
|
30
|
+
"@e-mc/types": "0.10.2",
|
|
31
|
+
"@e-mc/watch": "0.10.2",
|
|
32
|
+
"chalk": "4.1.2",
|
|
33
|
+
"diff": "^5.2.0",
|
|
34
|
+
"picomatch": "^4.0.2",
|
|
35
|
+
"strip-ansi": "6.0.1"
|
|
36
|
+
}
|
|
37
|
+
}
|