@e-mc/types 0.10.6 → 0.11.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/LICENSE CHANGED
@@ -8,4 +8,4 @@ Redistribution and use in source and binary forms, with or without modification,
8
8
 
9
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
10
 
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.
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,7 +1,7 @@
1
1
  # @e-mc/types
2
2
 
3
- * NodeJS 16
4
- * ES2020
3
+ * NodeJS 16 LTS
4
+ * ES2021
5
5
 
6
6
  ## General Usage
7
7
 
@@ -9,13 +9,14 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.10.6/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.0/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
16
+ import type { HighResolutionTime } from "./lib/node";
16
17
 
18
+ import type { BinaryLike, CipherGCMTypes, Encoding, RandomUUIDOptions } from "node:crypto";
17
19
  import type { BytesOptions } from "bytes";
18
- import type { BinaryLike, CipherGCMTypes, Encoding, RandomUUIDOptions } from "crypto";
19
20
 
20
21
  function createAbortError(reject: true): Promise<never>;
21
22
  function createAbortError(): DOMException;
@@ -196,14 +197,14 @@ const IMPORT_MAP: Record<string, string | undefined>;
196
197
 
197
198
  ## References
198
199
 
199
- - https://www.unpkg.com/@e-mc/types@0.10.6/index.d.ts
200
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/logger.d.ts
201
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/module.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.10.6/lib/object.d.ts
200
+ - https://www.unpkg.com/@e-mc/types@0.11.0/index.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.11.0/lib/logger.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.11.0/lib/module.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.11.0/lib/node.d.ts
203
204
 
204
205
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
205
206
  * https://www.npmjs.com/package/@types/bytes
206
207
 
207
208
  ## LICENSE
208
209
 
209
- BSD 3-Clause
210
+ BSD 3-Clause
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.9.15',
2
+ VERSION = '0.11.0',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
@@ -8,6 +8,7 @@ export const enum VAL_MESSAGE {
8
8
  SUCCESS = 'Success',
9
9
  COMPLETED = 'Completed',
10
10
  CHECKSUM = 'Checksum matched',
11
+ MODIFIED_FILE = 'File modified',
11
12
  MODIFIED_DIRECTORY = 'Directory was modified',
12
13
  COMMIT_TRANSACTION = 'Transactions were committed'
13
14
  }
@@ -38,18 +39,22 @@ export const enum ERR_MESSAGE {
38
39
  FAIL = 'FAIL!',
39
40
  WARN = 'WARN!',
40
41
  ABORTED = 'Aborted',
42
+ EXPIRED = 'Expired',
41
43
  ABORTED_HOST = 'Aborted by host',
42
44
  ABORTED_CLIENT = 'Aborted by client',
43
45
  ABORTED_PROCESS = 'Aborted by process',
44
- ABORTED_OPERATION = 'The operation was aborted',
46
+ ABORTED_OPERATION = 'This operation was aborted',
45
47
  FAILED = 'Failed',
46
48
  FAILED_CHECKSUM = 'Checksum did not match',
47
49
  PARAMETERS = 'Invalid parameters',
48
50
  FORMAT = 'Invalid format',
49
51
  CHECKSUM = 'Invalid checksum',
52
+ CONFIG = 'Invalid config',
50
53
  RESPONSE = 'Invalid response',
54
+ FUNCTION = 'Invalid function',
51
55
  SIZE = 'Size limit was exceeded',
52
56
  ERROR_CODE = 'Error code',
57
+ BUSY_RESOURCE = 'Resource already in use',
53
58
  PERMISSION = 'Operation not permitted',
54
59
  EXEC_PERMISSION = 'Exec command not permitted',
55
60
  NOT_CACHEABLE = 'Not able to cache',
@@ -64,6 +69,7 @@ export const enum ERR_MESSAGE {
64
69
  TIMEOUT = 'Timeout was exceeded',
65
70
  HANDLED_REJECTION = 'Handled rejection',
66
71
  UNSUPPORTED_ACCESS = 'Unsupported access',
72
+ UNSUPPORTED_PROTOCOL = 'Unsupported protocol',
67
73
  UNSUPPORTED_MIME = 'Unsupported MIME',
68
74
  UNSUPPORTED_READ = 'Not permitted to read file',
69
75
  UNSUPPORTED_WRITE = 'Not permitted to write file',
@@ -72,6 +78,7 @@ export const enum ERR_MESSAGE {
72
78
  NOTFOUND_BINARY = 'Binary not found',
73
79
  NOTFOUND_PACKAGE = 'Package not found',
74
80
  NOTFOUND_MIME = 'MIME not found',
81
+ NOTFOUND_TLS = 'TLS/SSL key and cert not found',
75
82
  INSTALL = 'Install required?',
76
83
  INLINE_METHOD = 'Unable to parse inline method',
77
84
  INLINE_OBJECT = 'Unable to parse inline object',
@@ -118,6 +125,7 @@ export const enum ERR_DB {
118
125
  TABLE = 'Missing database table',
119
126
  QUERY = 'Missing database query',
120
127
  CONNECTION = 'Missing connection string',
128
+ TLS = 'Missing TLS/SSL credentials',
121
129
  CLIENT = 'Unable to configure client',
122
130
  EXEC_QUERY = 'Unable to execute query',
123
131
  FILTER_QUERY = 'Unable to filter results',
@@ -159,6 +167,10 @@ export const enum ERR_CLOUD {
159
167
  METADATA_FAIL = 'Metadata failed'
160
168
  }
161
169
 
170
+ export const enum ERR_COMPRESS {
171
+ API_KEY = 'Missing API key'
172
+ }
173
+
162
174
  export const enum ERR_IMAGE {
163
175
  ROTATE = 'Unable to rotate image',
164
176
  FINALIZE = 'Unable to finalize image',
@@ -168,7 +180,17 @@ export const enum ERR_IMAGE {
168
180
 
169
181
  export const enum ERR_HTTP {
170
182
  HEADERS = 'Unable to process headers',
183
+ FORMAT = 'Unable to parse URI response',
184
+ SERVER_WEBSOCKET = 'Unable to create WebSocket server',
171
185
  ETAG = 'ETag not supported',
186
+ REQUEST = 'Invalid HTTP request',
187
+ TIMEOUT = 'HTTP request timeout',
188
+ TIMEOUT_CONNECTION = 'HTTP connection timeout',
189
+ DATA_RECEIVED = 'No data received',
190
+ REDIRECT_LIMIT = 'Exceeded redirect limit',
191
+ REDIRECT_FOLLOW = 'Follow redirect was disabled',
192
+ REDIRECT_MISSING = 'Missing redirect location',
193
+ EXPECT_CONTINUE = 'Did not receive continue acknowledgment',
172
194
  DOWNLOAD_SUCCESS = 'No files were successfully downloaded',
173
195
  MULTIPART_ATTACH = 'No files were attached'
174
196
  }
@@ -203,7 +225,6 @@ export const enum TIME {
203
225
  export const enum PACKAGE_NAME {
204
226
  CLOUD = '@e-mc/cloud',
205
227
  CLOUD_UTIL = '@e-mc/cloud/util',
206
- COMPAT_V4 = '@e-mc/compat-v4',
207
228
  COMPRESS = '@e-mc/compress',
208
229
  CORE = '@e-mc/core',
209
230
  DB = '@e-mc/db',
@@ -218,7 +239,6 @@ export const enum PACKAGE_NAME {
218
239
  IMAGE = '@e-mc/image',
219
240
  IMAGE_JIMP = '@pi-r/jimp',
220
241
  MODULE = '@e-mc/module',
221
- MODULE_LIB_V4 = '@e-mc/module/lib-v4',
222
242
  REQUEST = '@e-mc/request',
223
243
  REQUEST_HTTP_HOST = '@e-mc/request/http/host',
224
244
  REQUEST_UTIL = '@e-mc/request/util',
@@ -229,6 +249,14 @@ export const enum PACKAGE_NAME {
229
249
  WATCH_FILEGROUP = '@e-mc/watch/filegroup'
230
250
  }
231
251
 
252
+ export const enum MIME_TYPE {
253
+ MULTIPART = 'multipart/form-data',
254
+ URLENCODED = 'application/x-www-form-urlencoded',
255
+ JSON = 'application/json',
256
+ TEXT = 'text/plain',
257
+ OCTET_STREAM = 'application/octet-stream'
258
+ }
259
+
232
260
  export const enum ASSET_FLAG {
233
261
  NONE = 0,
234
262
  IGNORE = 1,
@@ -263,15 +291,15 @@ export const enum LOG_TYPE {
263
291
  }
264
292
 
265
293
  export const enum LOG_STATE {
266
- STDIN = 0,
267
- STDOUT = 1,
268
- STDERR = 2
294
+ STDIN,
295
+ STDOUT,
296
+ STDERR
269
297
  }
270
298
 
271
299
  export const enum READDIR_SORT {
272
- FILE = 0,
273
- DIRECTORY = 1,
274
- DESCENDING = 2
300
+ FILE,
301
+ DIRECTORY,
302
+ DESCENDING
275
303
  }
276
304
 
277
305
  export const enum SETTINGS_KEY_NAME {
@@ -281,6 +309,7 @@ export const enum SETTINGS_KEY_NAME {
281
309
  NODE_REQUIRE_EXT = "node.require.ext",
282
310
  NODE_REQUIRE_NPM = "node.require.npm",
283
311
  NODE_REQUIRE_INLINE = "node.require.inline",
312
+ NODE_PACKAGE_MANAGER = "node.settings.package_manager",
284
313
  TEMP_DIR = "temp.dir",
285
314
  TEMP_WRITE = "temp.write",
286
315
  PROCESS_PASSWORD = "process.password",
package/index.d.ts CHANGED
@@ -1,18 +1,14 @@
1
+ /// <reference lib="dom" />
1
2
  /// <reference path="./lib/type.d.ts" />
2
- /// <reference path="./lib/object.d.ts" />
3
3
 
4
4
  import type { LogArguments } from './lib/logger';
5
- import type { CloneObjectOptions } from './lib/module';
5
+ import type { HighResolutionTime } from './lib/node';
6
6
 
7
- import type { BinaryLike, CipherGCMTypes, Encoding } from 'crypto';
7
+ import type { BinaryLike, BinaryToTextEncoding, CipherGCMTypes, Encoding, RandomUUIDOptions } from 'node:crypto';
8
8
 
9
9
  // @ts-ignore
10
10
  import type { BytesOptions } from 'bytes';
11
11
 
12
- declare class AbortError extends Error {
13
- code: string;
14
- }
15
-
16
12
  declare namespace types {
17
13
  interface LOG_TYPE {
18
14
  UNKNOWN: 0;
@@ -266,10 +262,25 @@ declare namespace types {
266
262
 
267
263
  const IMPORT_MAP: StringMap;
268
264
 
265
+ interface CloneObjectOptions<T = unknown> {
266
+ target?: T;
267
+ deep?: boolean;
268
+ deepIgnore?: WeakSet<object>;
269
+ freezeDepth?: number | boolean;
270
+ mergeArray?: MergeArrayMethod;
271
+ mergeDepth?: number;
272
+ typedArray?: boolean;
273
+ symbol?: boolean;
274
+ inherited?: boolean;
275
+ nonenumerable?: boolean;
276
+ preserve?: boolean;
277
+ }
278
+
279
+ type MergeArrayMethod = "concat" | "concat-pre" | "includes" | "unshift" | "push" | "flat" | "join" | "slice" | "reverse" | ["flat", number] | ["join", string] | ["slice", number, number?];
269
280
  type WatchEventValue = WATCH_EVENT[keyof WATCH_EVENT];
270
281
 
271
282
  function createAbortError(reject: true): Promise<never>;
272
- function createAbortError(): AbortError;
283
+ function createAbortError(): DOMException;
273
284
  function hasBit(value: unknown, flags: number): boolean;
274
285
  function ignoreFlag(value: unknown): boolean;
275
286
  function cloneFlag(value: unknown): boolean;
@@ -279,8 +290,8 @@ declare namespace types {
279
290
  function processFlag(value: unknown): boolean;
280
291
  function mainFlag(value: unknown): boolean;
281
292
  function existsFlag(value: unknown): boolean;
282
- function getLogCurrent(): Null<LogArguments>;
283
- function setLogCurrent(value: LogArguments): void;
293
+ function getLogCurrent(): LogArguments | null;
294
+ function setLogCurrent(value: LogArguments | null): void;
284
295
  function setTempDir(value: string): boolean;
285
296
  function getTempDir(): string;
286
297
  function isArray<T>(value: unknown): value is T[];
@@ -288,12 +299,12 @@ declare namespace types {
288
299
  function isPlainObject<T = PlainObject>(value: unknown): value is T;
289
300
  function isString(value: unknown): value is string;
290
301
  function isEmpty(value: unknown): boolean;
291
- function asFunction<U = unknown, V = unknown>(value: unknown, sync?: boolean): Null<FunctionType<U, V>>;
292
- function parseTime(value: NumString, start?: number): number;
293
- function parseExpires(value: NumString, start?: number): number;
302
+ function asFunction<U = unknown, V = unknown>(value: unknown, sync?: boolean): FunctionType<U, V> | null;
303
+ function parseTime(value: number | string, start?: number): number;
304
+ function parseExpires(value: number | string, start?: number): number;
294
305
  function formatTime(value: number, char: string): string;
295
306
  function formatTime(value: number, elapsed?: boolean, char?: string): string;
296
- function convertTime(value: NumString): number;
307
+ function convertTime(value: number | string): number;
297
308
  function convertTime(value: HighResolutionTime, format: true): string;
298
309
  function convertTime(value: HighResolutionTime, format?: boolean): number;
299
310
  function hasGlob(value: string): boolean;
@@ -309,15 +320,18 @@ declare namespace types {
309
320
  function coerceObject<T = unknown>(data: T, cache: boolean): T;
310
321
  function coerceObject<T = unknown>(data: T, parseString?: FunctionArgs<[string]>, cache?: boolean): T;
311
322
  function getEncoding(value: unknown, fallback?: BufferEncoding): BufferEncoding;
312
- function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
313
- function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): Undef<string>;
314
- /** @deprecated crypto.randomUUID */
315
- function generateUUID(): string;
323
+ function encryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
324
+ function decryptUTF8(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, data: string, encoding?: Encoding): string | undefined;
325
+ function hashKey(data: BinaryLike, algorithm?: string, encoding?: BinaryToTextEncoding): string;
326
+ /** @deprecated - crypto.randomUUID */
327
+ function generateUUID(options?: RandomUUIDOptions): string;
316
328
  function incrementUUID(restart?: boolean): string;
317
329
  function validateUUID(value: unknown): boolean;
318
330
  function randomString(format: string, dictionary?: string): string;
319
331
  function errorValue(value: string, hint?: string): Error;
320
- function errorMessage(title: NumString, value: string, hint?: string): Error;
332
+ function errorMessage(title: number | string, value: string, hint?: string): Error;
333
+ function supported(major: number, minor?: number, patch?: number, lts?: boolean): boolean;
334
+ function importESM<T = unknown>(name: string, isDefault?: boolean, fromPath?: boolean): Promise<T>;
321
335
  function purgeMemory(percent?: number): number;
322
336
  }
323
337
 
package/index.js CHANGED
@@ -44,11 +44,11 @@ exports.incrementUUID = incrementUUID;
44
44
  exports.hashKey = hashKey;
45
45
  exports.supported = supported;
46
46
  exports.importESM = importESM;
47
- const path = require("path");
48
- const fs = require("fs");
49
- const crypto = require("crypto");
47
+ const path = require("node:path");
48
+ const fs = require("node:fs");
49
+ const crypto = require("node:crypto");
50
50
  const bytes = require("bytes");
51
- const url_1 = require("url");
51
+ const node_url_1 = require("node:url");
52
52
  class AbortError extends Error {
53
53
  constructor() {
54
54
  super("This operation was aborted");
@@ -63,6 +63,22 @@ class AbortError extends Error {
63
63
  return 20;
64
64
  }
65
65
  }
66
+ const PATTERN_CHARS = {
67
+ '-': '\\x2d',
68
+ '&': '\\x26',
69
+ '!': '\\x21',
70
+ '#': '\\x23',
71
+ '%': '\\x25',
72
+ ',': '\\x2c',
73
+ ':': '\\x3a',
74
+ ';': '\\x3b',
75
+ '<': '\\x3c',
76
+ '=': '\\x3d',
77
+ '>': '\\x3e',
78
+ '@': '\\x40',
79
+ '`': '\\x60',
80
+ '~': '\\x7e'
81
+ };
66
82
  const [VER_MAJOR, VER_MINOR, VER_PATCH] = process.version.substring(1).split('.').map(value => +value);
67
83
  const REGEXP_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
68
84
  const REGEXP_FUNCTION = /^(async\s+)?(function(?:\b|\s+)[\w_$]*\s*\(([^)]*)\)\s*\{(.*)\})$/s;
@@ -331,6 +347,12 @@ function parseStringDefault(value) {
331
347
  }
332
348
  return null;
333
349
  }
350
+ function checkFlags(value, flags) {
351
+ if (isObject(value)) {
352
+ value = value.flags;
353
+ }
354
+ return typeof value === 'number' && (value & flags) === flags;
355
+ }
334
356
  const padStart = (value, char) => value > 9 ? value.toString() : char + value;
335
357
  const convertScrypt = (key, iv, data) => crypto.scryptSync(key, iv, Math.ceil(data.length / 16) * 16);
336
358
  const isFunction = (value) => typeof value === 'function';
@@ -455,83 +477,6 @@ var THRESHOLD;
455
477
  THRESHOLD[THRESHOLD["WATCH_CHANGE"] = 100] = "WATCH_CHANGE";
456
478
  })(THRESHOLD || (exports.THRESHOLD = THRESHOLD = {}));
457
479
  exports.IMPORT_MAP = {
458
- "@squared-functions/cloud": "@e-mc/cloud",
459
- "@squared-functions/cloud/util": "@e-mc/cloud/util",
460
- "@squared-functions/compress-v3": "@e-mc/compress",
461
- "@squared-functions/core": "@e-mc/core",
462
- "@squared-functions/db": "@e-mc/db",
463
- "@squared-functions/db/pool": "@e-mc/db/pool",
464
- "@squared-functions/db/util": "@e-mc/db/util",
465
- "@squared-functions/document": "@e-mc/document",
466
- "@squared-functions/document/parse": "@e-mc/document/parse",
467
- "@squared-functions/document/parse/dom": "@e-mc/document/parse/dom",
468
- "@squared-functions/document/transform": "@e-mc/document/transform",
469
- "@squared-functions/document/asset": "@e-mc/document/asset",
470
- "@squared-functions/document/util": "@e-mc/document/util",
471
- "@squared-functions/file-manager": "@e-mc/file-manager",
472
- "@squared-functions/file-manager/http/host": "@e-mc/request/http/host",
473
- "@squared-functions/image-v3": "@e-mc/image",
474
- "@squared-functions/module": "@e-mc/module",
475
- "@squared-functions/task": "@e-mc/task",
476
- "@squared-functions/types": "@e-mc/types",
477
- "@squared-functions/watch": "@e-mc/watch",
478
- "@squared-functions/watch/filegroup": "@e-mc/watch/filegroup",
479
- "@squared-functions/document/android": "@pi-r/android",
480
- "@squared-functions/document/android/extensions/app/manifest": "@pi-r/android/extensions/app/manifest",
481
- "@squared-functions/document/android/extensions/gradle/dependencies": "@pi-r/android/extensions/gradle/dependencies",
482
- "@squared-functions/document/android/extensions/gradle/settings": "@pi-r/android/extensions/gradle/settings",
483
- "@squared-functions/document/android/extensions/task": "@pi-r/android/extensions/task",
484
- "@squared-functions/document/chrome": "@pi-r/chrome",
485
- "@squared-functions/image/jimp": "@pi-r/jimp",
486
- "@squared-functions/image/jimp/util": "@pi-r/jimp/util",
487
- "@squared-functions/image-v3/jimp": "@pi-r/jimp",
488
- "@squared-functions/task/gulp": "@pi-r/gulp",
489
- "@squared-functions/cloud/atlas": "@pi-r/atlas",
490
- "@squared-functions/cloud/aws": "@pi-r/aws",
491
- "@squared-functions/cloud/aws/download": "@pi-r/aws/download",
492
- "@squared-functions/cloud/aws/upload": "@pi-r/aws/upload",
493
- "@squared-functions/cloud/aws-v3": "@pi-r/aws-v3",
494
- "@squared-functions/cloud/aws-v3/download": "@pi-r/aws-v3/download",
495
- "@squared-functions/cloud/aws-v3/upload": "@pi-r/aws-v3/upload",
496
- "@squared-functions/cloud/azure": "@pi-r/azure",
497
- "@squared-functions/cloud/azure/download": "@pi-r/azure/download",
498
- "@squared-functions/cloud/azure/upload": "@pi-r/azure/upload",
499
- "@squared-functions/cloud/gcp": "@pi-r/gcp",
500
- "@squared-functions/cloud/gcp/download": "@pi-r/gcp/download",
501
- "@squared-functions/cloud/gcp/upload": "@pi-r/gcp/upload",
502
- "@squared-functions/cloud/ibm": "@pi-r/ibm",
503
- "@squared-functions/cloud/ibm/download": "@pi-r/ibm/download",
504
- "@squared-functions/cloud/ibm/upload": "@pi-r/ibm/upload",
505
- "@squared-functions/cloud/ibm-v1": "@pi-r/ibm",
506
- "@squared-functions/cloud/ibm-v1/download": "@pi-r/ibm/download",
507
- "@squared-functions/cloud/ibm-v1/upload": "@pi-r/ibm/upload",
508
- "@squared-functions/cloud/minio": "@pi-r/minio",
509
- "@squared-functions/cloud/minio/download": "@pi-r/minio/download",
510
- "@squared-functions/cloud/minio/upload": "@pi-r/minio/upload",
511
- "@squared-functions/cloud/oci": "@pi-r/oci",
512
- "@squared-functions/cloud/oci/download": "@pi-r/oci/download",
513
- "@squared-functions/cloud/oci/upload": "@pi-r/oci/upload",
514
- "@squared-functions/db/mongodb": "@pi-r/mongodb",
515
- "@squared-functions/db/mssql": "@pi-r/mssql",
516
- "@squared-functions/db/mysql": "@pi-r/mysql",
517
- "@squared-functions/db/oracle": "@pi-r/oracle",
518
- "@squared-functions/db/postgres": "@pi-r/postgres",
519
- "@squared-functions/db/redis": "@pi-r/redis",
520
- "@squared-functions/document/packages/@babel/core": "@pi-r/babel",
521
- "@squared-functions/document/packages/clean-css": "@pi-r/clean-css",
522
- "@squared-functions/document/packages/eslint": "@pi-r/eslint",
523
- "@squared-functions/document/packages/html-minifier": "@pi-r/html-minifier-terser",
524
- "@squared-functions/document/packages/html-minifier-terser": "@pi-r/html-minifier-terser",
525
- "@squared-functions/document/packages/html-validate": "@pi-r/html-validate",
526
- "@squared-functions/document/packages/postcss": "@pi-r/postcss",
527
- "@squared-functions/document/packages/posthtml": "@pi-r/posthtml",
528
- "@squared-functions/document/packages/prettier": "@pi-r/prettier",
529
- "@squared-functions/document/packages/rollup": "@pi-r/rollup",
530
- "@squared-functions/document/packages/sass": "@pi-r/sass",
531
- "@squared-functions/document/packages/stylelint": "@pi-r/stylelint",
532
- "@squared-functions/document/packages/svgo": "@pi-r/svgo",
533
- "@squared-functions/document/packages/terser": "@pi-r/terser",
534
- "@squared-functions/document/packages/uglify-js": "@pi-r/uglify-js",
535
480
  "atlas": "@pi-r/atlas",
536
481
  "aws": "@pi-r/aws",
537
482
  "aws-v3": "@pi-r/aws-v3",
@@ -539,8 +484,6 @@ exports.IMPORT_MAP = {
539
484
  "azure": "@pi-r/azure",
540
485
  "gcloud": "@pi-r/gcp",
541
486
  "gcp": "@pi-r/gcp",
542
- "ibm": "@pi-r/ibm",
543
- "minio": "@pi-r/minio",
544
487
  "oci": "@pi-r/oci",
545
488
  "tinify": "@pi-r/tinify",
546
489
  "mariadb": "@pi-r/mariadb",
@@ -554,8 +497,6 @@ exports.IMPORT_MAP = {
554
497
  "clean-css": "@pi-r/clean-css",
555
498
  "csso": "@pi-r/csso",
556
499
  "eslint": "@pi-r/eslint",
557
- "html-minifier": "@pi-r/html-minifier",
558
- "html-minifier-terser": "@pi-r/html-minifier-terser",
559
500
  "html-validate": "@pi-r/html-validate",
560
501
  "postcss": "@pi-r/postcss",
561
502
  "posthtml": "@pi-r/posthtml",
@@ -563,8 +504,12 @@ exports.IMPORT_MAP = {
563
504
  "rollup": "@pi-r/rollup",
564
505
  "sass": "@pi-r/sass",
565
506
  "stylelint": "@pi-r/stylelint",
566
- "svgo": "@pi-r/svgo",
567
507
  "terser": "@pi-r/terser",
508
+ "ibm": "@pi-r/ibm",
509
+ "minio": "@pi-r/minio",
510
+ "html-minifier": "@pi-r/html-minifier",
511
+ "html-minifier-terser": "@pi-r/html-minifier-terser",
512
+ "svgo": "@pi-r/svgo",
568
513
  "uglify-js": "@pi-r/uglify-js"
569
514
  };
570
515
  function createAbortError(reject) {
@@ -575,28 +520,28 @@ function hasBit(value, flags) {
575
520
  return typeof value === 'number' && (value & flags) > 0;
576
521
  }
577
522
  function ignoreFlag(value) {
578
- return typeof value === 'number' && (value & 1) === 1;
523
+ return checkFlags(value, 1);
579
524
  }
580
525
  function cloneFlag(value) {
581
- return typeof value === 'number' && (value & 2) === 2;
526
+ return checkFlags(value, 2);
582
527
  }
583
528
  function usingFlag(value) {
584
- return typeof value === 'number' && (value & 4) === 4;
529
+ return checkFlags(value, 4);
585
530
  }
586
531
  function watchFlag(value) {
587
- return typeof value === 'number' && (value & 8) === 8;
532
+ return checkFlags(value, 8);
588
533
  }
589
534
  function modifiedFlag(value) {
590
- return typeof value === 'number' && (value & 16) === 16;
535
+ return checkFlags(value, 16);
591
536
  }
592
537
  function processFlag(value) {
593
- return typeof value === 'number' && (value & 32) === 32;
538
+ return checkFlags(value, 32);
594
539
  }
595
540
  function mainFlag(value) {
596
- return typeof value === 'number' && (value & 64) === 64;
541
+ return checkFlags(value, 64);
597
542
  }
598
543
  function existsFlag(value) {
599
- return typeof value === 'number' && (value & 128) === 128;
544
+ return checkFlags(value, 128);
600
545
  }
601
546
  function getLogCurrent() {
602
547
  return LOG_CURRENT;
@@ -735,15 +680,17 @@ function formatTime(value, elapsed, char = ' ') {
735
680
  return result.join(char);
736
681
  }
737
682
  function convertTime(value, format) {
738
- let result;
683
+ let result = 0;
739
684
  if (Array.isArray(value)) {
740
- const time = Math.ceil((value[0] * 1000000000 + value[1]) / 1000000);
741
- result = format ? formatTime(time) : time;
685
+ result = Math.ceil((value[0] * 1000000000 + value[1]) / 1000000);
686
+ }
687
+ else if (typeof value === 'bigint') {
688
+ result = Number(value / BigInt(1000000));
742
689
  }
743
690
  else {
744
- result = parseTime(value);
691
+ return parseTime(value);
745
692
  }
746
- return result;
693
+ return (format ? formatTime(result) : result);
747
694
  }
748
695
  function hasGlob(value) {
749
696
  return REGEXP_GLOB.test(value);
@@ -753,8 +700,10 @@ function escapePattern(value, lookBehind) {
753
700
  case 'string': {
754
701
  let result = '', j = 0;
755
702
  for (let i = 0, length = value.length, ch; i < length; ++i) {
703
+ if (lookBehind && value[i - 1] === '\\') {
704
+ continue;
705
+ }
756
706
  switch (ch = value[i]) {
757
- case '-':
758
707
  case '.':
759
708
  case '+':
760
709
  case '*':
@@ -769,13 +718,16 @@ function escapePattern(value, lookBehind) {
769
718
  case '}':
770
719
  case '^':
771
720
  case '$':
772
- if (lookBehind && value[i - 1] === '\\') {
773
- break;
721
+ ch = '\\' + ch;
722
+ break;
723
+ default:
724
+ if (!(ch = PATTERN_CHARS[ch])) {
725
+ continue;
774
726
  }
775
- result += value.substring(j, i) + (ch === '-' ? '\\x2d' : '\\' + ch);
776
- j = i + 1;
777
727
  break;
778
728
  }
729
+ result += value.substring(j, i) + ch;
730
+ j = i + 1;
779
731
  }
780
732
  return j > 0 ? result + value.substring(j) : value;
781
733
  }
@@ -868,7 +820,7 @@ function cascadeObject(data, query, fallback) {
868
820
  return fallback;
869
821
  }
870
822
  function cloneObject(data, options) {
871
- let target, deep, deepIgnore, mergeArray, mergeDepth = Infinity, typedArray, inherited, nonenumerable, symbol, preserve;
823
+ let freezeDepth = -1, mergeDepth = Infinity, target, deep, deepIgnore, mergeArray, typedArray, inherited, nonenumerable, symbol, preserve;
872
824
  if (options === true) {
873
825
  deep = true;
874
826
  }
@@ -878,14 +830,20 @@ function cloneObject(data, options) {
878
830
  }
879
831
  else if (options) {
880
832
  ({ target, deep, deepIgnore, mergeArray, typedArray, inherited, nonenumerable, symbol, preserve } = options);
833
+ if (typeof options.freezeDepth === 'number') {
834
+ freezeDepth = options.freezeDepth - 1;
835
+ }
836
+ else if (options.freezeDepth) {
837
+ freezeDepth = Infinity;
838
+ }
881
839
  if (options.mergeDepth !== undefined) {
882
840
  mergeDepth = options.mergeDepth - 1;
883
841
  }
884
842
  }
885
843
  let nested;
886
- if (deep) {
844
+ if (deep || freezeDepth > 0) {
887
845
  deepIgnore ||= new WeakSet();
888
- nested = { deep, deepIgnore, mergeArray, mergeDepth, typedArray, preserve };
846
+ nested = { deep, deepIgnore, freezeDepth, mergeArray, mergeDepth, typedArray, preserve };
889
847
  }
890
848
  if (Array.isArray(data)) {
891
849
  deepIgnore?.add(data);
@@ -928,20 +886,23 @@ function cloneObject(data, options) {
928
886
  }
929
887
  const prop = target[attr];
930
888
  if (preserve && isPlainObject(prop) && isPlainObject(merge)) {
931
- (function recurse(current, next) {
889
+ (function recurse(current, next, depth) {
932
890
  for (const item of getProperties(next, inherited, nonenumerable, symbol)) {
933
891
  const b = next[item];
934
892
  if (item in current) {
935
893
  const a = current[item];
936
894
  if (isPlainObject(a) && isPlainObject(b)) {
937
- recurse(a, b);
895
+ recurse(a, b, depth - 1);
938
896
  }
939
897
  }
940
898
  else if (!(mergeArray && mergeDepth >= 0 && mergedArray(current, item, b, mergeArray))) {
941
899
  current[item] = b;
942
900
  }
943
901
  }
944
- })(prop, merge);
902
+ if (depth >= 0) {
903
+ Object.freeze(current);
904
+ }
905
+ })(prop, merge, freezeDepth - 1);
945
906
  }
946
907
  else if (!(mergeArray && mergeDepth >= 0 && mergedArray(target, attr, merge, mergeArray))) {
947
908
  target[attr] = merge;
@@ -951,6 +912,9 @@ function cloneObject(data, options) {
951
912
  else {
952
913
  return deep ? fromObject(data, typedArray) : data;
953
914
  }
915
+ if (freezeDepth >= 0) {
916
+ Object.freeze(target);
917
+ }
954
918
  return target;
955
919
  }
956
920
  function coerceObject(data, parseString, cache) {
@@ -1113,7 +1077,7 @@ function supported(major, minor = 0, patch = 0, lts) {
1113
1077
  }
1114
1078
  async function importESM(name, isDefault, fromPath) {
1115
1079
  if (fromPath && path.isAbsolute(name)) {
1116
- name = (0, url_1.pathToFileURL)(name).toString();
1080
+ name = (0, node_url_1.pathToFileURL)(name).toString();
1117
1081
  }
1118
1082
  const result = import(name);
1119
1083
  if (isDefault) {
package/lib/asset.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface BinaryAction {
15
15
  }
16
16
 
17
17
  export interface StreamAction {
18
- minStreamSize?: NumString;
18
+ minStreamSize?: number | string;
19
19
  }
20
20
 
21
21
  export interface FileData<T extends ExternalAsset> extends MimeTypeAction {
@@ -58,7 +58,7 @@ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, St
58
58
  id?: number;
59
59
  url?: URL;
60
60
  socketPath?: string;
61
- buffer?: Null<Buffer>;
61
+ buffer?: Buffer | null;
62
62
  localUri?: string;
63
63
  fetchType?: FetchType;
64
64
  sourceUTF8?: string;
@@ -74,4 +74,4 @@ export interface ExternalAsset extends FileAsset, BundleAction, BinaryAction, St
74
74
  invalid?: boolean;
75
75
  }
76
76
 
77
- export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512";
77
+ export type HashAlgorithm = "md5" | "sha1" | "sha256" | "sha224" | "sha384" | "sha512" | "ripemd" | "ripemd-160";