@e-mc/types 0.10.18 → 0.10.20

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 CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## Interface
11
11
 
12
- * [View Source](https://www.unpkg.com/@e-mc/types@0.10.18/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.20/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogArguments } from "./lib/logger";
@@ -197,10 +197,10 @@ const IMPORT_MAP: Record<string, string | undefined>;
197
197
 
198
198
  ## References
199
199
 
200
- - https://www.unpkg.com/@e-mc/types@0.10.18/index.d.ts
201
- - https://www.unpkg.com/@e-mc/types@0.10.18/lib/logger.d.ts
202
- - https://www.unpkg.com/@e-mc/types@0.10.18/lib/module.d.ts
203
- - https://www.unpkg.com/@e-mc/types@0.10.18/lib/object.d.ts
200
+ - https://www.unpkg.com/@e-mc/types@0.10.20/index.d.ts
201
+ - https://www.unpkg.com/@e-mc/types@0.10.20/lib/logger.d.ts
202
+ - https://www.unpkg.com/@e-mc/types@0.10.20/lib/module.d.ts
203
+ - https://www.unpkg.com/@e-mc/types@0.10.20/lib/object.d.ts
204
204
 
205
205
  * https://developer.mozilla.org/en-US/docs/Web/API/DOMException
206
206
  * https://www.npmjs.com/package/@types/bytes
package/constant.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const enum INTERNAL {
2
- VERSION = '0.10.18',
2
+ VERSION = '0.10.20',
3
3
  TEMP_DIR = 'tmp',
4
4
  CJS = '__cjs__'
5
5
  }
package/index.js CHANGED
@@ -991,24 +991,23 @@ function asFunction(value, sync = true) {
991
991
  }
992
992
  return null;
993
993
  }
994
- function getEncoding(value, fallback = 'utf-8') {
994
+ function getEncoding(value, fallback) {
995
995
  if (typeof value === 'string') {
996
- switch (value = value.trim().toLowerCase()) {
997
- case 'utf8':
998
- case 'utf-8':
999
- case 'unicode-1-1-utf-8':
1000
- return 'utf-8';
1001
- case 'utf16le':
1002
- case 'utf-16le':
1003
- case 'utf16':
1004
- case 'utf-16':
1005
- return 'utf16le';
996
+ const result = value.trim().toLowerCase();
997
+ if (result.slice(0, 3) === 'utf') {
998
+ switch (result.slice(result[3] === '-' ? 4 : 3)) {
999
+ case '8':
1000
+ return 'utf-8';
1001
+ case '16le':
1002
+ case '16':
1003
+ return 'utf16le';
1004
+ }
1006
1005
  }
1007
- if (Buffer.isEncoding(value)) {
1008
- return value;
1006
+ else if (Buffer.isEncoding(result)) {
1007
+ return result;
1009
1008
  }
1010
1009
  }
1011
- return fallback;
1010
+ return fallback || 'utf-8';
1012
1011
  }
1013
1012
  function encryptUTF8(algorithm, key, iv, data, encoding = 'hex') {
1014
1013
  if (checkCipherType(algorithm) && isString(data)) {
@@ -1126,7 +1125,7 @@ async function importESM(name, isDefault, fromPath) {
1126
1125
  if (fromPath && path.isAbsolute(name)) {
1127
1126
  name = (0, url_1.pathToFileURL)(name).toString();
1128
1127
  }
1129
- const result = import(name);
1128
+ const result = Function(`return import("${name}")`)();
1130
1129
  if (isDefault) {
1131
1130
  const out = await result;
1132
1131
  if (isObject(out) && 'default' in out) {
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { DataSource, DbDataSource, IncrementalMatch, LogStatus, TaskAction,
6
6
  import type { ExternalAsset, FileCommand, FileData, IFileThread, OutputFinalize } from './asset';
7
7
  import type { BucketWebsiteOptions, CloudDatabase, CloudFeatures, CloudFunctions, CloudService, CloudStorage, CloudStorageDownload, CloudStorageUpload, UploadAssetOptions } from './cloud';
8
8
  import type { BufferResult, CompressFormat, CompressLevel, ReadableOptions, TryFileCompressor } from './compress';
9
- import type { ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
9
+ import type { ClientConstructor, ClientDbConstructor, HostInitConfig, IAbortComponent, IClient, IClientDb, IPermission, JoinQueueOptions, PermissionReadWrite, ResumeThreadOptions, ThreadCountStat } from './core';
10
10
  import type { BatchQueryResult, DB_TYPE, ErrorQueryCallback, ExecuteBatchQueryOptions, ExecuteQueryOptions, HandleFailOptions, ProcessRowsOptions, QueryResult, SQL_COMMAND } from './db';
11
11
  import type { AsSourceFileOptions, ConfigOrTransformer, CustomizeOptions as CustomizeDocument, GenerateLintTableOptions, LintMessage, PluginConfig, SourceCode, SourceInput, SourceMap, SourceMapOptions, TransformAction, TransformCallback, TransformOutput, TransformResult, UpdateGradleOptions } from './document';
12
12
  import type { AssetContentOptions, ChecksumOptions, DeleteFileAddendum, FileOutput, FinalizeResult, FindAssetOptions, IHttpDiskCache, IHttpMemoryCache, ImageMimeMap, InstallData, PostFinalizeCallback, ReplaceOptions } from './filemanager';
@@ -105,7 +105,7 @@ declare namespace functions {
105
105
  get outputAs(): string;
106
106
  }
107
107
 
108
- interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ModuleConstructor {
108
+ interface ImageConstructor<T extends IHost = IHost, U extends ImageModule = ImageModule> extends ClientConstructor {
109
109
  /** @deprecated */
110
110
  readonly REGEXP_SIZERANGE: RegExp;
111
111
  transform<V extends TransformOptions>(file: string, command: string, options?: V): Promise<V extends { tempFile: true } ? string : Null<Buffer>>;
@@ -126,7 +126,7 @@ declare namespace functions {
126
126
  execute?<V extends IFileManager<W>, W extends ExternalAsset>(manager: V, task: PlainObject, callback: (value?: unknown) => void): void;
127
127
  }
128
128
 
129
- interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ModuleConstructor {
129
+ interface TaskConstructor<T extends IHost = IHost, U extends TaskModule = TaskModule> extends ClientConstructor {
130
130
  finalize<V extends ExternalAsset>(this: T, instance: ITask<T, U>, assets: V[]): Promise<unknown>;
131
131
  readonly prototype: ITask<T, U>;
132
132
  new(module?: U, ...args: unknown[]): ITask<T, U>;
@@ -255,7 +255,7 @@ declare namespace functions {
255
255
  get watching(): boolean;
256
256
  }
257
257
 
258
- 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 ModuleConstructor {
258
+ 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 {
259
259
  finalize(this: T, instance: IDocument<T, U, V, W, X, Y>): Promise<unknown>;
260
260
  createSourceMap(code: string, remove: boolean): SourceMap;
261
261
  createSourceMap(code: string, uri?: string, remove?: boolean): SourceMap;
@@ -291,7 +291,7 @@ declare namespace functions {
291
291
  get securePort(): number;
292
292
  }
293
293
 
294
- interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ModuleConstructor {
294
+ interface WatchConstructor<T extends IFileManager<U>, U extends ExternalAsset = ExternalAsset, V extends WatchModule = WatchModule, W extends FunctionType<unknown, any> = ModifiedPostFinalizeListener<U>> extends ClientConstructor {
295
295
  createServer(port: number, active: boolean): Null<ws.Server>;
296
296
  createServer(port: number, secure?: Null<SecureOptions>, active?: boolean): Null<ws.Server>;
297
297
  shutdown(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/types",
3
- "version": "0.10.18",
3
+ "version": "0.10.20",
4
4
  "description": "Type definitions for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/lib/dom.d.ts DELETED
@@ -1,9 +0,0 @@
1
- interface EventListenerOptions {
2
- capture?: boolean;
3
- }
4
-
5
- export interface AddEventListenerOptions extends EventListenerOptions {
6
- once?: boolean;
7
- passive?: boolean;
8
- signal?: AbortSignal;
9
- }