@e-mc/module 0.12.16 → 0.12.18

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
@@ -1,11 +1,7 @@
1
- Copyright 2024 An Pham
1
+ Copyright 2025 An Pham
2
2
 
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
6
 
7
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
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
-
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.
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.16/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.12.18/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { LogStatus } from "./squared";
@@ -422,15 +422,15 @@ interface LoggerModule {
422
422
 
423
423
  ## References
424
424
 
425
- - https://www.unpkg.com/@e-mc/types@0.12.16/lib/core.d.ts
426
- - https://www.unpkg.com/@e-mc/types@0.12.16/lib/logger.d.ts
427
- - https://www.unpkg.com/@e-mc/types@0.12.16/lib/module.d.ts
428
- - https://www.unpkg.com/@e-mc/types@0.12.16/lib/node.d.ts
429
- - https://www.unpkg.com/@e-mc/types@0.12.16/lib/settings.d.ts
425
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/core.d.ts
426
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/logger.d.ts
427
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/module.d.ts
428
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/node.d.ts
429
+ - https://www.unpkg.com/@e-mc/types@0.12.18/lib/settings.d.ts
430
430
 
431
431
  * https://www.npmjs.com/package/@types/node
432
432
  * https://www.npmjs.com/package/file-type
433
433
 
434
434
  ## LICENSE
435
435
 
436
- BSD 3-Clause
436
+ MIT
package/index.js CHANGED
@@ -18,7 +18,7 @@ const PROCESS_CWD = process.cwd();
18
18
  const PROCESS_STDOUT = process.stdout;
19
19
  const PLATFORM_WIN32 = process.platform === 'win32';
20
20
  const OS_HOMEDIR = os.homedir();
21
- const MEM_TOTAL = ((0, types_1.supported)(19, 6) || (0, types_1.supported)(18, 15, true)) && process.constrainedMemory() || os.totalmem();
21
+ const MEM_TOTAL = os.totalmem();
22
22
  const CPU_CORETOTAL = os.cpus().length;
23
23
  const SUPPORTED_CPUTHREAD = (0, types_1.supported)(23, 9);
24
24
  const SUPPORTED_CANPARSE = (0, types_1.supported)(19, 9) || (0, types_1.supported)(18, 17, true);
@@ -151,7 +151,15 @@ let PNPM_VER;
151
151
  let YARN_VER;
152
152
  let FILETYPE_ESM = null;
153
153
  function parseYaml(pathname) {
154
- return yaml.load(fs.readFileSync(pathname, 'utf8'));
154
+ let value;
155
+ try {
156
+ return yaml.load(value = fs.readFileSync(pathname, 'utf8'));
157
+ }
158
+ catch {
159
+ if (value) {
160
+ return JSON.parse(value);
161
+ }
162
+ }
155
163
  }
156
164
  function setPnpmVer() {
157
165
  if (PNPM_VER === undefined) {
@@ -662,14 +670,14 @@ function withinDir(value, base, override = false) {
662
670
  return value.startsWith(base) && (value !== base || override);
663
671
  }
664
672
  function formatPercent(value, precision) {
665
- if (value <= 0) {
673
+ if (value <= 0.0001) {
666
674
  return '0%';
667
675
  }
668
676
  if (value === (value | 0)) {
669
677
  return value + '00%';
670
678
  }
671
679
  value *= 100;
672
- return value.toPrecision(value < 1 ? 2 : precision) + '%';
680
+ return value.toPrecision(value < 0.001 ? 1 : value < 1 ? 2 : precision) + '%';
673
681
  }
674
682
  function relayMessage(instance, args) {
675
683
  const host = instance.host || instance;
@@ -851,7 +859,7 @@ class Module extends EventEmitter {
851
859
  static LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
852
860
  static LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
853
861
  static get VERSION() {
854
- return "0.12.16";
862
+ return "0.12.18";
855
863
  }
856
864
  static get LOG_TYPE() {
857
865
  return types_1.LOG_TYPE;
@@ -1832,7 +1840,7 @@ class Module extends EventEmitter {
1832
1840
  if (!this.isDir(outDir)) {
1833
1841
  return Promise.reject(errorDirectory(asFile(src) || "Unknown"));
1834
1842
  }
1835
- const pmOpts = PLATFORM_WIN32 ? { nocase: true, posixSlashes: true, windows: true } : {};
1843
+ const pmOpts = PLATFORM_WIN32 ? { nocase: true, windows: true } : {};
1836
1844
  let exclude, excludeDir, recursive;
1837
1845
  if ((0, types_1.isObject)(options)) {
1838
1846
  if (options.matchBase) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/module",
3
- "version": "0.12.16",
3
+ "version": "0.12.18",
4
4
  "description": "Module base class for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -16,10 +16,10 @@
16
16
  "squared"
17
17
  ],
18
18
  "author": "An Pham <anpham6@gmail.com>",
19
- "license": "BSD-3-Clause",
19
+ "license": "MIT",
20
20
  "homepage": "https://github.com/anpham6/e-mc#readme",
21
21
  "dependencies": {
22
- "@e-mc/types": "0.12.16",
22
+ "@e-mc/types": "0.12.18",
23
23
  "chalk": "4.1.2",
24
24
  "file-type": "^18.7.0",
25
25
  "js-yaml": "^4.1.1",