@e-mc/types 0.12.14 → 0.12.16
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 +6 -5
- package/constant.d.ts +1 -1
- package/index.d.ts +5 -2
- package/index.js +36 -16
- package/lib/asset.d.ts +1 -0
- package/lib/cloud.d.ts +1 -0
- package/lib/core.d.ts +4 -3
- package/lib/document.d.ts +2 -1
- package/lib/index.d.ts +24 -14
- package/lib/module.d.ts +8 -2
- package/lib/object.d.ts +5 -1
- package/lib/request.d.ts +1 -0
- package/package.json +1 -1
- package/lib/dom.d.ts +0 -9
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.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.12.16/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogArguments } from "./lib/logger";
|
|
@@ -77,6 +77,7 @@ function supported(major: number, minor: number, lts: boolean): boolean;
|
|
|
77
77
|
function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
78
78
|
function importESM(name: string | URL, isDefault: boolean, fromPath?: boolean): Promise<unknown>;
|
|
79
79
|
function importESM(name: string | URL, options?: ImportAttributes, fromPath?: boolean): Promise<unknown>;
|
|
80
|
+
function requireESM(name: string, url?: string | URL, expect?: string): unknown;
|
|
80
81
|
function purgeMemory(percent?: number): number;
|
|
81
82
|
|
|
82
83
|
interface LOG_TYPE {
|
|
@@ -204,10 +205,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
|
|
|
204
205
|
|
|
205
206
|
## References
|
|
206
207
|
|
|
207
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
208
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
209
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
210
|
-
- https://www.unpkg.com/@e-mc/types@0.12.
|
|
208
|
+
- https://www.unpkg.com/@e-mc/types@0.12.16/index.d.ts
|
|
209
|
+
- https://www.unpkg.com/@e-mc/types@0.12.16/lib/logger.d.ts
|
|
210
|
+
- https://www.unpkg.com/@e-mc/types@0.12.16/lib/module.d.ts
|
|
211
|
+
- https://www.unpkg.com/@e-mc/types@0.12.16/lib/node.d.ts
|
|
211
212
|
|
|
212
213
|
* https://developer.mozilla.org/en-US/docs/Web/API/DOMException
|
|
213
214
|
* https://www.npmjs.com/package/@types/bytes
|
package/constant.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -340,12 +340,15 @@ declare namespace types {
|
|
|
340
340
|
function sanitizeCmd(value: string, ...args: unknown[]): string;
|
|
341
341
|
function sanitizeArgs(value: string, doubleQuote?: boolean): string;
|
|
342
342
|
function sanitizeArgs(values: string[], doubleQuote?: boolean): string[];
|
|
343
|
-
function errorValue(value: string,
|
|
344
|
-
function
|
|
343
|
+
function errorValue(value: string, cause: unknown): Error;
|
|
344
|
+
function errorValue(value: string, hint?: string, cause?: unknown): Error;
|
|
345
|
+
function errorMessage(title: number | string, value: string, cause: unknown): Error;
|
|
346
|
+
function errorMessage(title: number | string, value: string, hint?: string, cause?: unknown): Error;
|
|
345
347
|
function supported(major: number, minor: number, lts: boolean): boolean;
|
|
346
348
|
function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
|
|
347
349
|
function importESM<T = unknown>(name: string | URL, isDefault: boolean, fromPath?: boolean): Promise<T>;
|
|
348
350
|
function importESM<T = unknown>(name: string | URL, options?: ImportAttributes, fromPath?: boolean): Promise<T>;
|
|
351
|
+
function requireESM<T = unknown>(name: string, url?: string | URL, expect?: string): T;
|
|
349
352
|
function purgeMemory(percent?: number): number;
|
|
350
353
|
}
|
|
351
354
|
|
package/index.js
CHANGED
|
@@ -47,15 +47,18 @@ exports.incrementUUID = incrementUUID;
|
|
|
47
47
|
exports.hashKey = hashKey;
|
|
48
48
|
exports.supported = supported;
|
|
49
49
|
exports.importESM = importESM;
|
|
50
|
+
exports.requireESM = requireESM;
|
|
50
51
|
const path = require("node:path");
|
|
51
52
|
const fs = require("node:fs");
|
|
52
53
|
const crypto = require("node:crypto");
|
|
53
54
|
const bytes = require("bytes");
|
|
55
|
+
const node_module_1 = require("node:module");
|
|
54
56
|
const node_os_1 = require("node:os");
|
|
55
57
|
const node_url_1 = require("node:url");
|
|
56
58
|
const PATTERN_CHARS = {
|
|
57
59
|
'&': '\\x26',
|
|
58
60
|
'!': '\\x21',
|
|
61
|
+
'"': '\\x22',
|
|
59
62
|
'#': '\\x23',
|
|
60
63
|
'%': '\\x25',
|
|
61
64
|
',': '\\x2c',
|
|
@@ -101,6 +104,7 @@ let CACHE_COERCED = new WeakSet();
|
|
|
101
104
|
let LOG_CURRENT = null;
|
|
102
105
|
let SUPPORTED_HASHSINGLE = false;
|
|
103
106
|
let SUPPORTED_IMPORTATTRIBUTES = false;
|
|
107
|
+
let SUPPORTED_REGEXPESCAPE = false;
|
|
104
108
|
let TEMP_DIR = path.join(process.cwd(), "tmp");
|
|
105
109
|
let INCREMENT_COUNT = 65536;
|
|
106
110
|
let INCREMENT_PREFIX = '';
|
|
@@ -739,6 +743,9 @@ function hasGlob(value) {
|
|
|
739
743
|
function escapePattern(value, symbols) {
|
|
740
744
|
switch (typeof value) {
|
|
741
745
|
case 'string': {
|
|
746
|
+
if (symbols && SUPPORTED_REGEXPESCAPE) {
|
|
747
|
+
return RegExp.escape(value);
|
|
748
|
+
}
|
|
742
749
|
let result = '', j = 0;
|
|
743
750
|
for (let i = 0, length = value.length, ch; i < length; ++i) {
|
|
744
751
|
switch (ch = value[i]) {
|
|
@@ -1029,18 +1036,18 @@ function asFunction(value, sync = true) {
|
|
|
1029
1036
|
}
|
|
1030
1037
|
function getEncoding(value, fallback) {
|
|
1031
1038
|
if (typeof value === 'string') {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1039
|
+
const result = value.trim().toLowerCase();
|
|
1040
|
+
if (result.slice(0, 3) === 'utf') {
|
|
1041
|
+
switch (result.slice(result[3] === '-' ? 4 : 3)) {
|
|
1042
|
+
case '8':
|
|
1043
|
+
return 'utf8';
|
|
1044
|
+
case '16le':
|
|
1045
|
+
case '16':
|
|
1046
|
+
return 'utf16le';
|
|
1047
|
+
}
|
|
1041
1048
|
}
|
|
1042
|
-
if (Buffer.isEncoding(
|
|
1043
|
-
return
|
|
1049
|
+
else if (Buffer.isEncoding(result)) {
|
|
1050
|
+
return result;
|
|
1044
1051
|
}
|
|
1045
1052
|
}
|
|
1046
1053
|
return fallback || 'utf8';
|
|
@@ -1169,11 +1176,19 @@ function sanitizeArgs(values, doubleQuote) {
|
|
|
1169
1176
|
}
|
|
1170
1177
|
return (typeof values === 'string' ? result[0] : result);
|
|
1171
1178
|
}
|
|
1172
|
-
function errorValue(value, hint) {
|
|
1173
|
-
|
|
1179
|
+
function errorValue(value, hint, cause) {
|
|
1180
|
+
if (!cause && isObject(hint)) {
|
|
1181
|
+
cause = hint;
|
|
1182
|
+
hint = undefined;
|
|
1183
|
+
}
|
|
1184
|
+
return new Error(value + (hint ? ` (${hint})` : ''), cause ? { cause } : undefined);
|
|
1174
1185
|
}
|
|
1175
|
-
function errorMessage(title, value, hint) {
|
|
1176
|
-
|
|
1186
|
+
function errorMessage(title, value, hint, cause) {
|
|
1187
|
+
if (!cause && isObject(hint)) {
|
|
1188
|
+
cause = hint;
|
|
1189
|
+
hint = undefined;
|
|
1190
|
+
}
|
|
1191
|
+
return new Error((isString(title) || typeof title === 'number' ? title + ': ' : '') + value + (hint ? ` (${hint})` : ''), cause ? { cause } : undefined);
|
|
1177
1192
|
}
|
|
1178
1193
|
function purgeMemory(percent) {
|
|
1179
1194
|
CACHE_COERCED = new WeakSet();
|
|
@@ -1238,5 +1253,10 @@ async function importESM(name, isDefault, fromPath) {
|
|
|
1238
1253
|
}
|
|
1239
1254
|
return result;
|
|
1240
1255
|
}
|
|
1256
|
+
function requireESM(name, url, expect) {
|
|
1257
|
+
const result = url ? (0, node_module_1.createRequire)(url)(name) : require(name);
|
|
1258
|
+
return process.features.require_module && isObject(result) && result.__esModule && 'default' in result && (!expect || typeof result.default === expect) ? result.default : result;
|
|
1259
|
+
}
|
|
1241
1260
|
SUPPORTED_HASHSINGLE = supported(20, 12, true) || supported(21, 7);
|
|
1242
|
-
SUPPORTED_IMPORTATTRIBUTES = supported(18, 20,
|
|
1261
|
+
SUPPORTED_IMPORTATTRIBUTES = supported(18, 20, true) || supported(20, 10);
|
|
1262
|
+
SUPPORTED_REGEXPESCAPE = supported(24);
|
package/lib/asset.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export interface IFileThread<T extends ExternalAsset = ExternalAsset> extends IA
|
|
|
36
36
|
getObject<U extends FileCommand<T>>(data?: PlainObject): U;
|
|
37
37
|
get host(): IFileManager<T>;
|
|
38
38
|
get queuedTasks(): FunctionType<void>[];
|
|
39
|
+
get localUri(): string | undefined;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export interface FileThreadConstructor<T extends ExternalAsset = ExternalAsset> {
|
package/lib/cloud.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export interface CloudStorageUpload<T = unknown, U = string, V = unknown, W = st
|
|
|
61
61
|
tags?: Record<string, string> | false;
|
|
62
62
|
options?: T;
|
|
63
63
|
fileGroup?: UploadContent[];
|
|
64
|
+
descendantsGroup?: string[];
|
|
64
65
|
localStorage?: boolean;
|
|
65
66
|
endpoint?: string;
|
|
66
67
|
all?: boolean;
|
package/lib/core.d.ts
CHANGED
|
@@ -70,9 +70,10 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
|
|
|
70
70
|
convertTime(value: number | string): number;
|
|
71
71
|
findResult(source: string, credential: unknown, queryString: string, timeout: number, sessionKey?: string | boolean, renewCache?: boolean): QueryResult | undefined;
|
|
72
72
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, options: StoreResultOptions): QueryResult;
|
|
73
|
+
/** @deprecated */
|
|
73
74
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, sessionKey: string, sessionExpires: number): QueryResult;
|
|
74
75
|
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue): QueryResult;
|
|
75
|
-
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue | undefined, options: StoreResultOptions): QueryResult;
|
|
76
|
+
storeResult(source: string, credential: unknown, queryString: string, result: QueryResult, cache: DbCacheValue | undefined, options: Omit<StoreResultOptions, "cache">): QueryResult;
|
|
76
77
|
purgeResult(prefix?: string): Promise<number>;
|
|
77
78
|
extractUUID(credential: unknown): string;
|
|
78
79
|
setPoolConfig(value: unknown): void;
|
|
@@ -83,7 +84,7 @@ export interface ClientDbConstructor<T extends IHost = IHost, U extends ClientMo
|
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export interface IWorkerGroup extends WorkerBase {
|
|
86
|
-
[Symbol.iterator]():
|
|
87
|
+
[Symbol.iterator](): IterableIterator<IWorkerChannel>;
|
|
87
88
|
add(name: string, item: IWorkerChannel, priority?: number): this;
|
|
88
89
|
get(name: string, force?: boolean | number): IWorkerChannel | undefined;
|
|
89
90
|
delete(name: string | IWorkerChannel): boolean;
|
|
@@ -107,7 +108,7 @@ export interface WorkerGroupConstructor {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
export interface IWorkerChannel<T = unknown> extends EventEmitter, Iterable<Worker>, WorkerInfo {
|
|
110
|
-
[Symbol.iterator]():
|
|
111
|
+
[Symbol.iterator](): IterableIterator<Worker>;
|
|
111
112
|
sendObject(data: unknown, transferList?: Transferable[], callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker;
|
|
112
113
|
sendBuffer(data: Buffer | SharedArrayBuffer, callback: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
|
|
113
114
|
sendBuffer(data: Buffer | SharedArrayBuffer, shared?: boolean, callback?: WorkerChannelResponse<T>, ...returnArgs: unknown[]): Worker | null;
|
package/lib/document.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { IDocument, IFileManager, IModule } from './index';
|
|
|
4
4
|
import type { ExternalAsset, InitialValue } from './asset';
|
|
5
5
|
import type { CloudStorage } from './cloud';
|
|
6
6
|
import type { LogComponent, LogDate } from './logger';
|
|
7
|
+
import type { DefaultAction } from './module';
|
|
7
8
|
import type { DocumentTransform } from './settings';
|
|
8
9
|
|
|
9
10
|
export interface DocumentAsset extends ExternalAsset, StorageAction<CloudStorage> {
|
|
@@ -189,7 +190,7 @@ export interface CustomizeOptions {
|
|
|
189
190
|
transform?: DocumentTransform;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
export interface AsSourceFileOptions extends EncodingAction {
|
|
193
|
+
export interface AsSourceFileOptions extends EncodingAction, DefaultAction {
|
|
193
194
|
cache?: boolean;
|
|
194
195
|
}
|
|
195
196
|
|
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction,
|
|
|
5
5
|
import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
|
|
6
6
|
import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, DeleteObjectsOptions, UploadAssetOptions } from './cloud';
|
|
7
7
|
import type { BrotliCompressLevel, BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
|
|
8
|
-
import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
8
|
+
import type { ClientConstructor, ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
|
|
9
9
|
import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
|
|
10
10
|
import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
|
|
11
11
|
import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
|
|
@@ -92,7 +92,7 @@ declare namespace functions {
|
|
|
92
92
|
new(module?: U): ICompress<T, U>;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule> extends IClient<T, U> {
|
|
95
|
+
interface IImage<T extends IHost = IHost, U extends ImageModule = ImageModule, V extends ExternalAsset = ExternalAsset> extends IClient<T, U> {
|
|
96
96
|
resizeData?: ResizeData | null;
|
|
97
97
|
cropData?: CropData | null;
|
|
98
98
|
rotateData?: RotateData | null;
|
|
@@ -110,13 +110,13 @@ declare namespace functions {
|
|
|
110
110
|
parseQuality(value: string): QualityData | null;
|
|
111
111
|
parseOpacity(value: string): number;
|
|
112
112
|
parseWorker(command: string | CommandData, outputType?: string): CommandData | null;
|
|
113
|
-
using
|
|
113
|
+
using?(data: IFileThread<V>, command: string): Promise<unknown>;
|
|
114
114
|
get outputAs(): string;
|
|
115
115
|
set host(value);
|
|
116
116
|
get host(): T | null;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends
|
|
119
|
+
interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ClientConstructor, IWorkerConstructor {
|
|
120
120
|
readonly MIME_JPEG: string;
|
|
121
121
|
readonly MIME_PNG: string;
|
|
122
122
|
readonly MIME_WEBP: string;
|
|
@@ -132,19 +132,19 @@ declare namespace functions {
|
|
|
132
132
|
new(module?: U, ...args: unknown[]): IImage<T, U>;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule> extends IClient<T, U> {
|
|
136
|
-
using
|
|
135
|
+
interface ITask<T extends IHost = IHost, U extends TaskModule = TaskModule, V extends ExternalAsset = ExternalAsset> extends IClient<T, U> {
|
|
136
|
+
using?(data: IFileThread<V>): Promise<unknown>;
|
|
137
137
|
collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
|
|
138
138
|
map?(tasks: Command[]): Promise<SpawnResult | void>[];
|
|
139
139
|
series?(tasks: Command[]): Promise<unknown>;
|
|
140
140
|
parallel?(tasks: Command[]): Promise<unknown>;
|
|
141
141
|
spawn?(task: PlainObject, callback: (result?: SpawnResult) => void): void;
|
|
142
|
-
execute?<
|
|
142
|
+
execute?<W extends IFileManager<X>, X extends ExternalAsset>(manager: W, task: PlainObject, callback: (value?: unknown) => void): void;
|
|
143
143
|
set host(value);
|
|
144
144
|
get host(): T | null;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends
|
|
147
|
+
interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ClientConstructor {
|
|
148
148
|
finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
|
|
149
149
|
readonly prototype: ITask<T, U>;
|
|
150
150
|
new(module?: U, ...args: unknown[]): ITask<T, U>;
|
|
@@ -280,12 +280,14 @@ declare namespace functions {
|
|
|
280
280
|
get host(): T | null;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends
|
|
283
|
+
interface DocumentConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends ClientModule = DocumentModule, W extends DocumentComponent = DocumentComponent, X extends DocumentComponentOption = DocumentComponentOption, Y extends ICloud = ICloud<T>> extends ClientConstructor {
|
|
284
284
|
finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
285
285
|
createSourceMap(code: string, remove: boolean): SourceMap;
|
|
286
286
|
createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
|
|
287
287
|
writeSourceMap(uri: string, data: SourceCode, options?: SourceMapOptions): string | undefined;
|
|
288
|
+
/** @deprecated */
|
|
288
289
|
updateGradle(source: string, namespaces: string[], value: string, upgrade: boolean): string;
|
|
290
|
+
/** @deprecated */
|
|
289
291
|
updateGradle(source: string, namespaces: string[], value: string, options?: UpdateGradleOptions): string;
|
|
290
292
|
generateLintTable(messages: LintMessage[], options: GenerateLintTableOptions): LogComponent[];
|
|
291
293
|
cleanup?(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
|
|
@@ -319,7 +321,7 @@ declare namespace functions {
|
|
|
319
321
|
get host(): T | null;
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends
|
|
324
|
+
interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ClientConstructor {
|
|
323
325
|
createServer(port: number, active: boolean): ws.Server | null;
|
|
324
326
|
createServer(port: number, secure?: SecureOptions | null, active?: boolean): ws.Server | null;
|
|
325
327
|
shutdown(): void;
|
|
@@ -354,6 +356,7 @@ declare namespace functions {
|
|
|
354
356
|
rclone(uri: string | URL, pathname: string | URL): Promise<string[]>;
|
|
355
357
|
rclone(uri: string | URL, options?: RcloneOptions): Promise<string[]>;
|
|
356
358
|
json(uri: string | URL, options?: OpenOptions): Promise<object | null>;
|
|
359
|
+
blob(uri: string | URL, options?: OpenOptions): Promise<Blob | null>;
|
|
357
360
|
pipe(uri: string | URL, to: Writable, options?: OpenOptions): Promise<null>;
|
|
358
361
|
opts<V extends OpenOptions>(url: string | URL, options?: V): HostConfig & V;
|
|
359
362
|
open(uri: string | URL, options: OpenOptions): HttpRequestClient;
|
|
@@ -619,6 +622,7 @@ declare namespace functions {
|
|
|
619
622
|
getThreadCount(full: true): ThreadCountStat;
|
|
620
623
|
getThreadCount(username: string, iv?: BinaryLike): ThreadCountStat;
|
|
621
624
|
getThreadCount(username?: string | boolean, iv?: BinaryLike): number;
|
|
625
|
+
parseIp(value: unknown, kind?: "ipv4" | "ipv6"): string;
|
|
622
626
|
getLogDelayed(): FormatMessageArgs[];
|
|
623
627
|
getPermissionFromSettings(freeze?: boolean): IPermission;
|
|
624
628
|
readonly prototype: IHost;
|
|
@@ -817,11 +821,17 @@ declare namespace functions {
|
|
|
817
821
|
readBuffer(value: string | URL, cache?: boolean | ReadBufferOptions): Buffer | null;
|
|
818
822
|
resolveMime(data: FileTypeFormat): Promise<FileTypeResult | undefined>;
|
|
819
823
|
lookupMime(value: string, extension?: boolean): string;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
824
|
+
/** @deprecated class */
|
|
825
|
+
initCpuUsage(instance?: IModule, thread?: boolean): CpuUsage;
|
|
826
|
+
/** @deprecated private */
|
|
827
|
+
getCpuUsage(start: CpuUsage, format: true, thread?: boolean): string;
|
|
828
|
+
/** @deprecated private */
|
|
829
|
+
getCpuUsage(start: CpuUsage, format?: boolean, thread?: boolean): number;
|
|
830
|
+
/** @deprecated private */
|
|
823
831
|
getMemUsage(format: true | "%" | Unit, free?: boolean): string;
|
|
832
|
+
/** @deprecated private */
|
|
824
833
|
getMemUsage(format?: boolean, free?: boolean): number;
|
|
834
|
+
/** @deprecated private */
|
|
825
835
|
formatCpuMem(start: CpuUsage, all?: boolean): string;
|
|
826
836
|
getPackageVersion(name: string | [string, string], options?: PackageVersionOptions): string;
|
|
827
837
|
checkSemVer(name: string | [string, string], options: CheckSemVerOptions): boolean;
|
|
@@ -842,4 +852,4 @@ declare namespace functions {
|
|
|
842
852
|
}
|
|
843
853
|
}
|
|
844
854
|
|
|
845
|
-
export = functions;
|
|
855
|
+
export = functions;
|
package/lib/module.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ export interface RequireAction {
|
|
|
16
16
|
requireExt?: string | string[] | boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
export interface DefaultAction {
|
|
20
|
+
default?: boolean;
|
|
21
|
+
url?: string | URL;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export interface ThrowsAction {
|
|
20
25
|
throwsPermission?: boolean;
|
|
21
26
|
throwsDoesNotExist?: boolean;
|
|
@@ -41,7 +46,7 @@ export interface FileSystemOptions extends PermissionOptions, ThrowsAction {
|
|
|
41
46
|
ignorePermission?: boolean;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
export interface ReadFileOptions extends FileSystemOptions, StreamBase, RequireAction, EncodingAction {
|
|
49
|
+
export interface ReadFileOptions extends FileSystemOptions, StreamBase, RequireAction, EncodingAction, DefaultAction {
|
|
45
50
|
cache?: boolean;
|
|
46
51
|
}
|
|
47
52
|
|
|
@@ -57,6 +62,7 @@ export interface CopyFileOptions extends FileSystemOptions {
|
|
|
57
62
|
overwrite?: boolean;
|
|
58
63
|
createDir?: boolean;
|
|
59
64
|
outSrc?: string;
|
|
65
|
+
mode?: number;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
export interface RemoveDirOptions extends FileSystemOptions {
|
|
@@ -67,7 +73,7 @@ export interface RemoveDirOptions extends FileSystemOptions {
|
|
|
67
73
|
export type MoveFileOptions = CopyFileOptions;
|
|
68
74
|
export type CreateDirOptions = FileSystemOptions;
|
|
69
75
|
|
|
70
|
-
export interface ParseFunctionOptions extends RequireAction {
|
|
76
|
+
export interface ParseFunctionOptions extends RequireAction, DefaultAction {
|
|
71
77
|
absolute?: boolean;
|
|
72
78
|
sync?: boolean;
|
|
73
79
|
external?: boolean;
|
package/lib/object.d.ts
CHANGED
package/lib/request.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ export interface OpenOptions extends KeepAliveAction, SilentAction, EncodingActi
|
|
|
148
148
|
progressId?: number | string;
|
|
149
149
|
outFormat?: { out: BufferFormat; parser?: PlainObject };
|
|
150
150
|
outFilename?: string | null;
|
|
151
|
+
outContentType?: string;
|
|
151
152
|
outHeaders?: IncomingHttpHeaders | null;
|
|
152
153
|
outStream?: Writable | null;
|
|
153
154
|
outAbort?: AbortController | null;
|
package/package.json
CHANGED