@e-mc/module 0.13.6 → 0.13.7

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.
Files changed (3) hide show
  1. package/README.md +11 -6
  2. package/index.js +10 -10
  3. package/package.json +2 -2
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.13.6/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.13.7/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -306,6 +306,11 @@ interface MemoryModule {
306
306
  exclude?: string[];
307
307
  expires?: number | string;
308
308
  };
309
+ gc?: {
310
+ expires?: number | string;
311
+ expires_limit?: number | string;
312
+ interval?: number | string;
313
+ };
309
314
  };
310
315
  }
311
316
 
@@ -422,11 +427,11 @@ interface LoggerModule {
422
427
 
423
428
  ## References
424
429
 
425
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/core.d.ts
426
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/logger.d.ts
427
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/module.d.ts
428
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/node.d.ts
429
- - https://www.unpkg.com/@e-mc/types@0.13.6/lib/settings.d.ts
430
+ - https://www.unpkg.com/@e-mc/types@0.13.7/lib/core.d.ts
431
+ - https://www.unpkg.com/@e-mc/types@0.13.7/lib/logger.d.ts
432
+ - https://www.unpkg.com/@e-mc/types@0.13.7/lib/module.d.ts
433
+ - https://www.unpkg.com/@e-mc/types@0.13.7/lib/node.d.ts
434
+ - https://www.unpkg.com/@e-mc/types@0.13.7/lib/settings.d.ts
430
435
 
431
436
  * https://www.npmjs.com/package/@types/node
432
437
 
package/index.js CHANGED
@@ -411,7 +411,7 @@ function tryRemoveDir(srcDir, empty, recursive) {
411
411
  const failed = [];
412
412
  const current = Date.now();
413
413
  let entry;
414
- fs.readdirSync(srcDir, { withFileTypes: true }).forEach(file => {
414
+ for (const file of fs.readdirSync(srcDir, { withFileTypes: true })) {
415
415
  const pathname = path.join(srcDir, file.name);
416
416
  try {
417
417
  if (file.isDirectory()) {
@@ -431,7 +431,7 @@ function tryRemoveDir(srcDir, empty, recursive) {
431
431
  catch {
432
432
  failed.push(pathname);
433
433
  }
434
- });
434
+ }
435
435
  if (!empty && failed.length === 0) {
436
436
  fs.rmdirSync(srcDir);
437
437
  }
@@ -632,7 +632,7 @@ function isMatch(value, globs) {
632
632
  function listDir(src, paths, depth, include, exclude, excludeDir, outFiles) {
633
633
  const srcDir = path.join(src, ...paths);
634
634
  try {
635
- fs.readdirSync(srcDir, { withFileTypes: true }).forEach(file => {
635
+ for (const file of fs.readdirSync(srcDir, { withFileTypes: true })) {
636
636
  if (file.isFile()) {
637
637
  const pathname = path.join(srcDir, file.name);
638
638
  const pathglob = pathname.substring(src.length);
@@ -646,7 +646,7 @@ function listDir(src, paths, depth, include, exclude, excludeDir, outFiles) {
646
646
  listDir(src, subDirs, depth - 1, include, exclude, excludeDir, outFiles);
647
647
  }
648
648
  }
649
- });
649
+ }
650
650
  }
651
651
  catch {
652
652
  }
@@ -878,7 +878,7 @@ class Module extends EventEmitter {
878
878
  static LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
879
879
  static LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
880
880
  static get VERSION() {
881
- return "0.13.6";
881
+ return "0.13.7";
882
882
  }
883
883
  static get LOG_TYPE() {
884
884
  return types_1.LOG_TYPE;
@@ -3563,7 +3563,7 @@ class Module extends EventEmitter {
3563
3563
  return false;
3564
3564
  }
3565
3565
  checkFail(message, options) {
3566
- switch (options.code || message.code) {
3566
+ switch (options.code || message instanceof Error && message.code) {
3567
3567
  case types_1.ERR_CODE.MODULE_NOT_FOUND:
3568
3568
  case types_1.ERR_CODE.ERR_MODULE_NOT_FOUND:
3569
3569
  if (options.exec) {
@@ -3865,7 +3865,7 @@ class Module extends EventEmitter {
3865
3865
  }
3866
3866
  return options;
3867
3867
  }
3868
- #supportsProperty(name) {
3868
+ supportsProperty(name) {
3869
3869
  return !(name in this.#supports) || this.supports(name);
3870
3870
  }
3871
3871
  get moduleName() {
@@ -3897,7 +3897,7 @@ class Module extends EventEmitter {
3897
3897
  return this._host;
3898
3898
  }
3899
3899
  set sessionId(value) {
3900
- if (this.#supportsProperty('sessionId')) {
3900
+ if (this.supportsProperty('sessionId')) {
3901
3901
  this.#sessionId = value;
3902
3902
  }
3903
3903
  }
@@ -3905,7 +3905,7 @@ class Module extends EventEmitter {
3905
3905
  return this.#sessionId || this.host?.sessionId || '';
3906
3906
  }
3907
3907
  set broadcastId(value) {
3908
- if (this.#supportsProperty('broadcastId')) {
3908
+ if (this.supportsProperty('broadcastId')) {
3909
3909
  this.#broadcastId = value;
3910
3910
  }
3911
3911
  }
@@ -3913,7 +3913,7 @@ class Module extends EventEmitter {
3913
3913
  return this.#broadcastId || this.host?.broadcastId || '';
3914
3914
  }
3915
3915
  set permission(value) {
3916
- if (this.#supportsProperty('permission')) {
3916
+ if (this.supportsProperty('permission')) {
3917
3917
  this.#permission = value;
3918
3918
  }
3919
3919
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.13.6",
3
+ "version": "0.13.7",
4
4
  "description": "Module base class for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "license": "BSD-3-Clause",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/types": "0.13.6",
22
+ "@e-mc/types": "0.13.7",
23
23
  "chalk": "4.1.2",
24
24
  "file-type": "^20.5.0",
25
25
  "js-yaml": "^4.1.1",