@e-mc/module 0.9.6 → 0.10.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/README.md +29 -19
- package/index.d.ts +4 -4
- package/index.js +750 -547
- package/lib-v4.d.ts +4 -4
- package/lib-v4.js +14 -14
- package/package.json +3 -3
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/lib-v4.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports.validateUUID = exports.renameExt = exports.isString = exports.isPlainObject = exports.isObject = exports.formatSize = exports.escapePattern = exports.toTimeMs = exports.coerceObject = exports.cloneObject = exports.asFunction =
|
|
2
|
+
exports.validateUUID = exports.renameExt = exports.isString = exports.isPlainObject = exports.isObject = exports.formatSize = exports.escapePattern = exports.toTimeMs = exports.coerceObject = exports.cloneObject = exports.asFunction = void 0;
|
|
3
|
+
exports.hasSize = hasSize;
|
|
4
|
+
exports.getSize = getSize;
|
|
5
|
+
exports.hasSameStat = hasSameStat;
|
|
6
|
+
exports.byteLength = byteLength;
|
|
7
|
+
exports.cleanupStream = cleanupStream;
|
|
8
|
+
exports.generateUUID = generateUUID;
|
|
9
|
+
exports.existsSafe = existsSafe;
|
|
10
|
+
exports.isFileHTTP = isFileHTTP;
|
|
11
|
+
exports.isFileUNC = isFileUNC;
|
|
12
|
+
exports.isPathUNC = isPathUNC;
|
|
13
|
+
exports.readFileSafe = readFileSafe;
|
|
14
|
+
exports.getFunctions = getFunctions;
|
|
15
|
+
exports.allSettled = allSettled;
|
|
3
16
|
const path = require("path");
|
|
4
17
|
const fs = require("fs");
|
|
5
18
|
const types_1 = require("@e-mc/types");
|
|
@@ -29,7 +42,6 @@ function hasSize(value, keepEmpty) {
|
|
|
29
42
|
}
|
|
30
43
|
return false;
|
|
31
44
|
}
|
|
32
|
-
exports.hasSize = hasSize;
|
|
33
45
|
function getSize(value, diskUsed) {
|
|
34
46
|
try {
|
|
35
47
|
return fs[diskUsed ? 'lstatSync' : 'statSync'](value).size;
|
|
@@ -38,7 +50,6 @@ function getSize(value, diskUsed) {
|
|
|
38
50
|
return 0;
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
|
-
exports.getSize = getSize;
|
|
42
53
|
function hasSameStat(src, dest, keepEmpty) {
|
|
43
54
|
try {
|
|
44
55
|
if (fs.existsSync(dest)) {
|
|
@@ -56,11 +67,9 @@ function hasSameStat(src, dest, keepEmpty) {
|
|
|
56
67
|
}
|
|
57
68
|
return false;
|
|
58
69
|
}
|
|
59
|
-
exports.hasSameStat = hasSameStat;
|
|
60
70
|
function byteLength(value, encoding) {
|
|
61
71
|
return typeof value === 'string' && (path.isAbsolute(value) || index_1.isPath(value)) ? getSize(value) : Buffer.byteLength(value, encoding && (0, types_1.getEncoding)(encoding));
|
|
62
72
|
}
|
|
63
|
-
exports.byteLength = byteLength;
|
|
64
73
|
function cleanupStream(stream, uri) {
|
|
65
74
|
stream.removeAllListeners();
|
|
66
75
|
stream.destroy();
|
|
@@ -75,31 +84,24 @@ function cleanupStream(stream, uri) {
|
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
|
-
exports.cleanupStream = cleanupStream;
|
|
79
87
|
function generateUUID(format, dictionary) {
|
|
80
88
|
return format ? (0, types_1.randomString)(format, dictionary) : (0, types_1.generateUUID)();
|
|
81
89
|
}
|
|
82
|
-
exports.generateUUID = generateUUID;
|
|
83
90
|
function existsSafe(value, isFile) {
|
|
84
91
|
return index_1.isPath(value, isFile);
|
|
85
92
|
}
|
|
86
|
-
exports.existsSafe = existsSafe;
|
|
87
93
|
function isFileHTTP(value) {
|
|
88
94
|
return index_1.isFile(value, 'http/s');
|
|
89
95
|
}
|
|
90
|
-
exports.isFileHTTP = isFileHTTP;
|
|
91
96
|
function isFileUNC(value) {
|
|
92
97
|
return index_1.isFile(value, 'unc');
|
|
93
98
|
}
|
|
94
|
-
exports.isFileUNC = isFileUNC;
|
|
95
99
|
function isPathUNC(value) {
|
|
96
100
|
return index_1.isPath(value, 'unc');
|
|
97
101
|
}
|
|
98
|
-
exports.isPathUNC = isPathUNC;
|
|
99
102
|
async function readFileSafe(value, encoding, cache) {
|
|
100
103
|
return encoding === 'buffer' ? index_1.readBuffer(value, cache) : index_1.readText(value, encoding, cache);
|
|
101
104
|
}
|
|
102
|
-
exports.readFileSafe = readFileSafe;
|
|
103
105
|
function getFunctions(values, absolute, sync = true, outFailed) {
|
|
104
106
|
let options, context;
|
|
105
107
|
if ((0, types_1.isObject)(absolute)) {
|
|
@@ -133,7 +135,6 @@ function getFunctions(values, absolute, sync = true, outFailed) {
|
|
|
133
135
|
}
|
|
134
136
|
return result;
|
|
135
137
|
}
|
|
136
|
-
exports.getFunctions = getFunctions;
|
|
137
138
|
async function allSettled(tasks, rejected, options) {
|
|
138
139
|
if (rejected) {
|
|
139
140
|
return Promise.allSettled(tasks).then(result => {
|
|
@@ -155,4 +156,3 @@ async function allSettled(tasks, rejected, options) {
|
|
|
155
156
|
}
|
|
156
157
|
return Promise.allSettled(tasks);
|
|
157
158
|
}
|
|
158
|
-
exports.allSettled = allSettled;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Module base class for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/types": "0.
|
|
23
|
+
"@e-mc/types": "0.10.0",
|
|
24
24
|
"chalk": "4.1.2",
|
|
25
|
-
"file-type": "
|
|
25
|
+
"file-type": "^18.7.0",
|
|
26
26
|
"js-yaml": "^4.1.0",
|
|
27
27
|
"mime-types": "^2.1.35",
|
|
28
28
|
"picomatch": "^4.0.2",
|