@e-mc/module 0.9.0 → 0.9.2
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 +10 -10
- package/README.md +7 -23
- package/index.d.ts +4 -4
- package/index.js +9 -24
- package/lib-v4.d.ts +4 -4
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Copyright 2024 An Pham
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
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
|
-
|
|
1
|
+
Copyright 2024 An Pham
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
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
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,6 +1,6 @@
|
|
|
1
1
|
# @e-mc/module
|
|
2
2
|
|
|
3
|
-
* NodeJS
|
|
3
|
+
* NodeJS 16
|
|
4
4
|
* ES2020
|
|
5
5
|
|
|
6
6
|
## General Usage
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.9.2/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { LogStatus } from "./squared";
|
|
@@ -389,29 +389,13 @@ type BackgroundColor = typeof IBackgroundColor | `#${string}`;
|
|
|
389
389
|
type ForegroundColor = typeof IForegroundColor | `#${string}`;
|
|
390
390
|
```
|
|
391
391
|
|
|
392
|
-
## NodeJS 14 LTS
|
|
393
|
-
|
|
394
|
-
Any optional fail safe dependencies were removed as of `E-mc 0.9`. The code itself will still be *ES2020* and will continue to work equivalently when self-installing these dependencies:
|
|
395
|
-
|
|
396
|
-
### Under 15.4 + 16.0
|
|
397
|
-
|
|
398
|
-
```sh
|
|
399
|
-
npm i abort-controller event-target-shim
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
### Under 14.17 + 15.6
|
|
403
|
-
|
|
404
|
-
```sh
|
|
405
|
-
npm i uuid
|
|
406
|
-
```
|
|
407
|
-
|
|
408
392
|
## References
|
|
409
393
|
|
|
410
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
411
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
412
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
413
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
414
|
-
- https://www.unpkg.com/@e-mc/types@0.9.
|
|
394
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/core.d.ts
|
|
395
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/logger.d.ts
|
|
396
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/module.d.ts
|
|
397
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/node.d.ts
|
|
398
|
+
- https://www.unpkg.com/@e-mc/types@0.9.2/lib/settings.d.ts
|
|
415
399
|
|
|
416
400
|
* https://www.npmjs.com/package/@types/node
|
|
417
401
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ModuleConstructor } from '../types/lib';
|
|
2
|
-
|
|
3
|
-
declare const Module: ModuleConstructor;
|
|
4
|
-
|
|
1
|
+
import type { ModuleConstructor } from '../types/lib';
|
|
2
|
+
|
|
3
|
+
declare const Module: ModuleConstructor;
|
|
4
|
+
|
|
5
5
|
export = Module;
|
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const filetype = require("file-type");
|
|
|
9
9
|
const mime = require("mime-types");
|
|
10
10
|
const pm = require("picomatch");
|
|
11
11
|
const chalk = require("chalk");
|
|
12
|
+
const yaml = require("js-yaml");
|
|
12
13
|
const stripansi = require("strip-ansi");
|
|
13
14
|
const EventEmitter = require("events");
|
|
14
15
|
const types_1 = require("@e-mc/types");
|
|
@@ -134,7 +135,7 @@ let TEMP_DIR = path.join(PROCESS_CWD, "tmp");
|
|
|
134
135
|
let PNPM_VER;
|
|
135
136
|
let YARN_VER;
|
|
136
137
|
function parseYaml(pathname) {
|
|
137
|
-
return
|
|
138
|
+
return yaml.load(fs.readFileSync(pathname, 'utf-8'));
|
|
138
139
|
}
|
|
139
140
|
function setPnpmVer() {
|
|
140
141
|
if (PNPM_VER === undefined) {
|
|
@@ -694,7 +695,7 @@ class Module extends EventEmitter {
|
|
|
694
695
|
this[_f] = new AbortController();
|
|
695
696
|
this[_g] = null;
|
|
696
697
|
}
|
|
697
|
-
static get VERSION() { return "0.9.
|
|
698
|
+
static get VERSION() { return "0.9.2"; }
|
|
698
699
|
static get LOG_TYPE() { return types_1.LOG_TYPE; }
|
|
699
700
|
static get STATUS_TYPE() { return types_1.STATUS_TYPE; }
|
|
700
701
|
static get MAX_TIMEOUT() { return 2147483647; }
|
|
@@ -994,7 +995,7 @@ class Module extends EventEmitter {
|
|
|
994
995
|
value = getValue();
|
|
995
996
|
}
|
|
996
997
|
const unit = options.messageUnit ? type & 256 ? options.messageUnit.padStart(options.messageUnitMinWidth || 0) : options.messageUnit : '';
|
|
997
|
-
const getMessage = (m, u) => type & 256 && messageUnitIndent === undefined ? (u + m).trimEnd() : u ? (m + (messageUnitIndent === undefined ? ' ' : '') + u).trimStart() : m;
|
|
998
|
+
const getMessage = (m, u) => (type & 256) && messageUnitIndent === undefined ? (u + m).trimEnd() : u ? (m + (messageUnitIndent === undefined ? ' ' : '') + u).trimStart() : m;
|
|
998
999
|
if (coloring) {
|
|
999
1000
|
let { titleColor, titleBgColor, valueColor, valueBgColor, valueBold, messageWidth, messageColor, messageBgColor, messageBold } = options;
|
|
1000
1001
|
if (!titleColor && !titleBgColor) {
|
|
@@ -2697,7 +2698,7 @@ class Module extends EventEmitter {
|
|
|
2697
2698
|
if (!err) {
|
|
2698
2699
|
setCache(data);
|
|
2699
2700
|
}
|
|
2700
|
-
|
|
2701
|
+
callback(err, data);
|
|
2701
2702
|
});
|
|
2702
2703
|
}
|
|
2703
2704
|
return;
|
|
@@ -2734,7 +2735,7 @@ class Module extends EventEmitter {
|
|
|
2734
2735
|
if (!err) {
|
|
2735
2736
|
this.emit('file:write', outSrc, options);
|
|
2736
2737
|
}
|
|
2737
|
-
|
|
2738
|
+
callback(err);
|
|
2738
2739
|
});
|
|
2739
2740
|
return;
|
|
2740
2741
|
}
|
|
@@ -2771,7 +2772,7 @@ class Module extends EventEmitter {
|
|
|
2771
2772
|
if (!err) {
|
|
2772
2773
|
this.emit('file:delete', outSrc, options);
|
|
2773
2774
|
}
|
|
2774
|
-
|
|
2775
|
+
callback(err);
|
|
2775
2776
|
});
|
|
2776
2777
|
return;
|
|
2777
2778
|
}
|
|
@@ -2826,7 +2827,7 @@ class Module extends EventEmitter {
|
|
|
2826
2827
|
if (!err) {
|
|
2827
2828
|
this.emit('file:copy', outDest, options);
|
|
2828
2829
|
}
|
|
2829
|
-
|
|
2830
|
+
callback(err);
|
|
2830
2831
|
});
|
|
2831
2832
|
return;
|
|
2832
2833
|
}
|
|
@@ -2905,7 +2906,7 @@ class Module extends EventEmitter {
|
|
|
2905
2906
|
if (!err) {
|
|
2906
2907
|
this.emit('file:move', outDest, options);
|
|
2907
2908
|
}
|
|
2908
|
-
|
|
2909
|
+
callback(err);
|
|
2909
2910
|
});
|
|
2910
2911
|
return;
|
|
2911
2912
|
}
|
|
@@ -3629,22 +3630,6 @@ Module.LOG_STYLE_INFO = Object.freeze({ titleBgColor: 'bgBlue', titleColor: 'whi
|
|
|
3629
3630
|
Module.LOG_STYLE_WARN = Object.freeze({ titleBgColor: 'bgBlack', titleColor: 'yellow', titleBold: true });
|
|
3630
3631
|
Module.LOG_STYLE_NOTICE = Object.freeze({ titleBgColor: 'bgGrey', titleColor: 'white' });
|
|
3631
3632
|
Module.LOG_STYLE_REVERSE = Object.freeze({ titleBgColor: 'bgWhite', titleColor: 'black', messageBgColor: 'bgGrey' });
|
|
3632
|
-
if (!Module.supported(15, 4)) {
|
|
3633
|
-
if (!global.AbortController) {
|
|
3634
|
-
try {
|
|
3635
|
-
({ AbortController: global.AbortController } = require('abort-controller'));
|
|
3636
|
-
}
|
|
3637
|
-
catch {
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3640
|
-
if (!global.EventTarget) {
|
|
3641
|
-
try {
|
|
3642
|
-
({ EventTarget: global.EventTarget } = require('event-target-shim'));
|
|
3643
|
-
}
|
|
3644
|
-
catch {
|
|
3645
|
-
}
|
|
3646
|
-
}
|
|
3647
|
-
}
|
|
3648
3633
|
EventEmitter.defaultMaxListeners = Infinity;
|
|
3649
3634
|
Object.freeze(types_1.LOG_TYPE);
|
|
3650
3635
|
Object.freeze(types_1.STATUS_TYPE);
|
package/lib-v4.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IModuleLibV4 } from '../types/lib/compat-v4';
|
|
2
|
-
|
|
3
|
-
declare const LibV4: IModuleLibV4;
|
|
4
|
-
|
|
1
|
+
import type { IModuleLibV4 } from '../types/lib/compat-v4';
|
|
2
|
+
|
|
3
|
+
declare const LibV4: IModuleLibV4;
|
|
4
|
+
|
|
5
5
|
export = LibV4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.9.
|
|
23
|
+
"@e-mc/types": "0.9.2",
|
|
24
24
|
"chalk": "4.1.2",
|
|
25
25
|
"file-type": "16.5.4",
|
|
26
26
|
"js-yaml": "^4.1.0",
|