@e-mc/file-manager 0.9.6 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -23
- package/index.d.ts +5 -5
- package/index.js +1733 -1187
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.10.0/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
@@ -31,13 +31,13 @@ interface IFileManager extends IHost, Set<string> {
|
|
|
31
31
|
processTimeout: number;
|
|
32
32
|
cacheToDisk: IHttpDiskCache<ExternalAsset>;
|
|
33
33
|
cacheToMemory: IHttpMemoryCache<ExternalAsset>;
|
|
34
|
-
Request: IRequest
|
|
34
|
+
Request: IRequest;
|
|
35
35
|
Document: InstallData<IDocument<IFileManager, ExternalAsset>, DocumentConstructor<IFileManager, ExternalAsset>>[];
|
|
36
36
|
Task: InstallData<ITask, TaskConstructor>[];
|
|
37
37
|
Image: Map<ImageMimeMap> | null;
|
|
38
38
|
Cloud: ICloud | null;
|
|
39
39
|
Watch: WatchInstance<ExternalAsset> | null;
|
|
40
|
-
Compress: ICompress
|
|
40
|
+
Compress: ICompress | null;
|
|
41
41
|
readonly documentAssets: ExternalAsset[];
|
|
42
42
|
readonly taskAssets: (ExternalAsset & Required<TaskAction>)[];
|
|
43
43
|
readonly dataSourceItems: DataSource[];
|
|
@@ -62,7 +62,7 @@ interface IFileManager extends IHost, Set<string> {
|
|
|
62
62
|
install(name: "image", targets: Map<string, ImageConstructor>, module?: ImageModule): void;
|
|
63
63
|
install(name: "watch", module: WatchModule): WatchInstance<ExternalAsset> | undefined;
|
|
64
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
|
|
65
|
+
install(name: "compress", module?: CompressModule): ICompress | undefined;
|
|
66
66
|
install(name: string, ...args: unknown[]): IModule | undefined;
|
|
67
67
|
using(...items: ExternalAsset[] | [boolean, ...ExternalAsset[]]): this;
|
|
68
68
|
contains(item: ExternalAsset, condition?: (target: ExternalAsset) => boolean): boolean;
|
|
@@ -79,6 +79,7 @@ interface IFileManager extends IHost, Set<string> {
|
|
|
79
79
|
hasDocument(instance: IModule, document: string | string[] | undefined): boolean;
|
|
80
80
|
getDocumentAssets(instance: IModule, condition?: (target: ExternalAsset) => boolean): ExternalAsset[];
|
|
81
81
|
getDataSourceItems(instance: IModule, condition?: (target: DataSource) => boolean): DataSource[];
|
|
82
|
+
checkFilename(file: ExternalAsset, pathname?: string): string;
|
|
82
83
|
setLocalUri(file: ExternalAsset, replace?: boolean): FileOutput;
|
|
83
84
|
getLocalUri(data: FileData<ExternalAsset>): string;
|
|
84
85
|
getMimeType(data: FileData<ExternalAsset>): string;
|
|
@@ -119,11 +120,12 @@ interface IFileManager extends IHost, Set<string> {
|
|
|
119
120
|
deleteFile(src: string, options: DeleteFileOptions & DeleteFileAddendum, callback?: NoParamCallback): unknown;
|
|
120
121
|
restart(recursive?: boolean | "abort", emptyDir?: boolean): void;
|
|
121
122
|
restart(recursive?: boolean | "abort", exclusions?: string[], emptyDir?: boolean): void;
|
|
122
|
-
finalizeCompress(assets: ExternalAsset[]): Promise<
|
|
123
|
-
finalizeDocument(): Promise<
|
|
124
|
-
finalizeTask(assets: (ExternalAsset & Required<TaskAction>)[]): Promise<
|
|
125
|
-
finalizeCloud(): Promise<
|
|
126
|
-
|
|
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>;
|
|
127
129
|
finalize(): Promise<void>;
|
|
128
130
|
close(): void;
|
|
129
131
|
reset(): boolean;
|
|
@@ -199,6 +201,8 @@ interface FileManagerConstructor extends HostConstructor {
|
|
|
199
201
|
## Settings
|
|
200
202
|
|
|
201
203
|
```typescript
|
|
204
|
+
import type { BackgroundColor, ForegroundColor, LoggerProgress } from "./logger";
|
|
205
|
+
|
|
202
206
|
interface ProcessModule {
|
|
203
207
|
thread?: {
|
|
204
208
|
sub_limit?: number;
|
|
@@ -238,6 +242,7 @@ interface ErrorModule {
|
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
interface LoggerModule {
|
|
245
|
+
progress?: LoggerProgress;
|
|
241
246
|
session_id?: boolean | number;
|
|
242
247
|
}
|
|
243
248
|
```
|
|
@@ -273,12 +278,26 @@ FileManager.loadSettings({ // Global
|
|
|
273
278
|
}
|
|
274
279
|
});
|
|
275
280
|
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
{
|
|
279
|
-
|
|
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
|
+
};
|
|
280
299
|
|
|
281
|
-
const instance = new FileManager("/path/workspace",
|
|
300
|
+
const instance = new FileManager("/path/workspace", requestData, { disk_write: ["/path/workspace/output/**"] });
|
|
282
301
|
await instance.start();
|
|
283
302
|
```
|
|
284
303
|
|
|
@@ -286,15 +305,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
|
|
|
286
305
|
|
|
287
306
|
## References
|
|
288
307
|
|
|
289
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
290
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
291
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
292
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
293
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
294
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
295
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
296
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
297
|
-
- https://www.unpkg.com/@e-mc/types@0.
|
|
308
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/squared.d.ts
|
|
309
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/asset.d.ts
|
|
310
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/core.d.ts
|
|
311
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/filemanager.d.ts
|
|
312
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/logger.d.ts
|
|
313
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/module.d.ts
|
|
314
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/node.d.ts
|
|
315
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/request.d.ts
|
|
316
|
+
- https://www.unpkg.com/@e-mc/types@0.10.0/lib/settings.d.ts
|
|
298
317
|
|
|
299
318
|
* https://www.npmjs.com/package/@types/node
|
|
300
319
|
|
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;
|