@rsdoctor/utils 1.2.2 → 1.2.4-beta.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/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +2427 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/filesize/index.d.ts +58 -0
- package/compiled/filesize/index.js +255 -0
- package/compiled/filesize/license +28 -0
- package/compiled/filesize/package.json +1 -0
- package/dist/{type/build → build}/envinfo.d.ts +0 -1
- package/dist/{type/build → build}/file/cache.d.ts +0 -1
- package/dist/build/file/index.d.ts +3 -0
- package/dist/{type/build → build}/file/sharding.d.ts +0 -1
- package/dist/{type/build → build}/index.d.ts +0 -1
- package/dist/{type/build → build}/json.d.ts +0 -1
- package/dist/{type/build → build}/process.d.ts +0 -1
- package/dist/{type/build → build}/server.d.ts +0 -1
- package/dist/build.cjs +1310 -0
- package/dist/build.js +343 -0
- package/dist/{type/common → common}/alerts.d.ts +0 -1
- package/dist/{type/common → common}/algorithm.d.ts +0 -1
- package/dist/{type/common → common}/bundle.d.ts +0 -1
- package/dist/{type/common → common}/crypto.d.ts +0 -1
- package/dist/{type/common → common}/data/index.d.ts +0 -1
- package/dist/{type/common → common}/file.d.ts +0 -1
- package/dist/{type/common → common}/global-config.d.ts +0 -1
- package/dist/{type/common → common}/graph/assets.d.ts +0 -1
- package/dist/{type/common → common}/graph/chunk.d.ts +0 -1
- package/dist/{type/common → common}/graph/dependency.d.ts +0 -1
- package/dist/{type/common → common}/graph/entrypoints.d.ts +0 -1
- package/dist/{type/common → common}/graph/index.d.ts +0 -1
- package/dist/{type/common → common}/graph/modules.d.ts +0 -1
- package/dist/{type/common → common}/index.d.ts +0 -1
- package/dist/{type/common → common}/loader.d.ts +0 -1
- package/dist/{type/common → common}/lodash.d.ts +0 -1
- package/dist/{type/common → common}/manifest.d.ts +0 -1
- package/dist/{type/common → common}/package.d.ts +0 -1
- package/dist/{type/common → common}/plugin.d.ts +0 -1
- package/dist/{type/common → common}/resolver.d.ts +0 -1
- package/dist/{type/common → common}/rspack.d.ts +0 -1
- package/dist/{type/common → common}/summary.d.ts +0 -1
- package/dist/{type/common → common}/time.d.ts +0 -1
- package/dist/{type/common → common}/url.d.ts +0 -1
- package/dist/common.cjs +1328 -0
- package/dist/common.js +1255 -0
- package/dist/{type/error → error}/error.d.ts +0 -1
- package/dist/{type/error → error}/index.d.ts +0 -1
- package/dist/{type/error → error}/transform.d.ts +0 -1
- package/dist/{type/error → error}/utils.d.ts +0 -1
- package/dist/error.cjs +310 -0
- package/dist/error.js +232 -0
- package/dist/logger.cjs +82 -0
- package/dist/{type/logger.d.ts → logger.d.ts} +0 -1
- package/dist/{esm/logger.mjs → logger.js} +8 -13
- package/dist/{type/rule-utils → rule-utils}/document/document.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/document/index.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/document/server.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/document/types.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/index.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/asserts.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/index.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/parser.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/types.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/utils.d.ts +0 -1
- package/dist/ruleUtils.cjs +320 -0
- package/dist/ruleUtils.js +256 -0
- package/package.json +35 -39
- package/dist/cjs/build/envinfo.js +0 -121
- package/dist/cjs/build/file/cache.js +0 -76
- package/dist/cjs/build/file/index.js +0 -81
- package/dist/cjs/build/file/sharding.js +0 -96
- package/dist/cjs/build/index.js +0 -52
- package/dist/cjs/build/json.js +0 -103
- package/dist/cjs/build/process.js +0 -54
- package/dist/cjs/build/server.js +0 -158
- package/dist/cjs/common/alerts.js +0 -51
- package/dist/cjs/common/algorithm.js +0 -75
- package/dist/cjs/common/bundle.js +0 -62
- package/dist/cjs/common/crypto.js +0 -54
- package/dist/cjs/common/data/index.js +0 -396
- package/dist/cjs/common/file.js +0 -44
- package/dist/cjs/common/global-config.js +0 -81
- package/dist/cjs/common/graph/assets.js +0 -314
- package/dist/cjs/common/graph/chunk.js +0 -81
- package/dist/cjs/common/graph/dependency.js +0 -50
- package/dist/cjs/common/graph/entrypoints.js +0 -38
- package/dist/cjs/common/graph/index.js +0 -96
- package/dist/cjs/common/graph/modules.js +0 -133
- package/dist/cjs/common/index.js +0 -104
- package/dist/cjs/common/loader.js +0 -320
- package/dist/cjs/common/lodash.js +0 -93
- package/dist/cjs/common/manifest.js +0 -70
- package/dist/cjs/common/package.js +0 -96
- package/dist/cjs/common/plugin.js +0 -91
- package/dist/cjs/common/resolver.js +0 -92
- package/dist/cjs/common/rspack.js +0 -65
- package/dist/cjs/common/summary.js +0 -42
- package/dist/cjs/common/time.js +0 -86
- package/dist/cjs/common/url.js +0 -54
- package/dist/cjs/error/error.js +0 -199
- package/dist/cjs/error/index.js +0 -73
- package/dist/cjs/error/transform.js +0 -182
- package/dist/cjs/error/utils.js +0 -62
- package/dist/cjs/index.js +0 -40
- package/dist/cjs/logger.js +0 -106
- package/dist/cjs/rule-utils/document/document.js +0 -92
- package/dist/cjs/rule-utils/document/index.js +0 -78
- package/dist/cjs/rule-utils/document/server.js +0 -49
- package/dist/cjs/rule-utils/document/types.js +0 -18
- package/dist/cjs/rule-utils/index.js +0 -69
- package/dist/cjs/rule-utils/parser/asserts.js +0 -138
- package/dist/cjs/rule-utils/parser/index.js +0 -87
- package/dist/cjs/rule-utils/parser/parser.js +0 -57
- package/dist/cjs/rule-utils/parser/types.js +0 -41
- package/dist/cjs/rule-utils/parser/utils.js +0 -170
- package/dist/esm/build/envinfo.mjs +0 -57
- package/dist/esm/build/file/cache.mjs +0 -23
- package/dist/esm/build/file/index.mjs +0 -4
- package/dist/esm/build/file/sharding.mjs +0 -50
- package/dist/esm/build/index.mjs +0 -6
- package/dist/esm/build/json.mjs +0 -66
- package/dist/esm/build/process.mjs +0 -17
- package/dist/esm/build/server.mjs +0 -96
- package/dist/esm/common/alerts.mjs +0 -17
- package/dist/esm/common/algorithm.mjs +0 -32
- package/dist/esm/common/bundle.mjs +0 -22
- package/dist/esm/common/crypto.mjs +0 -17
- package/dist/esm/common/data/index.mjs +0 -362
- package/dist/esm/common/file.mjs +0 -7
- package/dist/esm/common/global-config.mjs +0 -32
- package/dist/esm/common/graph/assets.mjs +0 -238
- package/dist/esm/common/graph/chunk.mjs +0 -32
- package/dist/esm/common/graph/dependency.mjs +0 -10
- package/dist/esm/common/graph/entrypoints.mjs +0 -4
- package/dist/esm/common/graph/index.mjs +0 -5
- package/dist/esm/common/graph/modules.mjs +0 -78
- package/dist/esm/common/index.mjs +0 -19
- package/dist/esm/common/loader.mjs +0 -247
- package/dist/esm/common/lodash.mjs +0 -32
- package/dist/esm/common/manifest.mjs +0 -30
- package/dist/esm/common/package.mjs +0 -56
- package/dist/esm/common/plugin.mjs +0 -48
- package/dist/esm/common/resolver.mjs +0 -46
- package/dist/esm/common/rspack.mjs +0 -25
- package/dist/esm/common/summary.mjs +0 -8
- package/dist/esm/common/time.mjs +0 -43
- package/dist/esm/common/url.mjs +0 -14
- package/dist/esm/error/error.mjs +0 -154
- package/dist/esm/error/index.mjs +0 -3
- package/dist/esm/error/transform.mjs +0 -138
- package/dist/esm/error/utils.mjs +0 -22
- package/dist/esm/index.mjs +0 -3
- package/dist/esm/rule-utils/document/document.mjs +0 -58
- package/dist/esm/rule-utils/document/index.mjs +0 -3
- package/dist/esm/rule-utils/document/server.mjs +0 -12
- package/dist/esm/rule-utils/document/types.mjs +0 -0
- package/dist/esm/rule-utils/index.mjs +0 -2
- package/dist/esm/rule-utils/parser/asserts.mjs +0 -104
- package/dist/esm/rule-utils/parser/index.mjs +0 -4
- package/dist/esm/rule-utils/parser/parser.mjs +0 -23
- package/dist/esm/rule-utils/parser/types.mjs +0 -7
- package/dist/esm/rule-utils/parser/utils.mjs +0 -109
- package/dist/type/build/envinfo.d.ts.map +0 -1
- package/dist/type/build/file/cache.d.ts.map +0 -1
- package/dist/type/build/file/index.d.ts +0 -4
- package/dist/type/build/file/index.d.ts.map +0 -1
- package/dist/type/build/file/sharding.d.ts.map +0 -1
- package/dist/type/build/index.d.ts.map +0 -1
- package/dist/type/build/json.d.ts.map +0 -1
- package/dist/type/build/process.d.ts.map +0 -1
- package/dist/type/build/server.d.ts.map +0 -1
- package/dist/type/common/alerts.d.ts.map +0 -1
- package/dist/type/common/algorithm.d.ts.map +0 -1
- package/dist/type/common/bundle.d.ts.map +0 -1
- package/dist/type/common/crypto.d.ts.map +0 -1
- package/dist/type/common/data/index.d.ts.map +0 -1
- package/dist/type/common/file.d.ts.map +0 -1
- package/dist/type/common/global-config.d.ts.map +0 -1
- package/dist/type/common/graph/assets.d.ts.map +0 -1
- package/dist/type/common/graph/chunk.d.ts.map +0 -1
- package/dist/type/common/graph/dependency.d.ts.map +0 -1
- package/dist/type/common/graph/entrypoints.d.ts.map +0 -1
- package/dist/type/common/graph/index.d.ts.map +0 -1
- package/dist/type/common/graph/modules.d.ts.map +0 -1
- package/dist/type/common/index.d.ts.map +0 -1
- package/dist/type/common/loader.d.ts.map +0 -1
- package/dist/type/common/lodash.d.ts.map +0 -1
- package/dist/type/common/manifest.d.ts.map +0 -1
- package/dist/type/common/package.d.ts.map +0 -1
- package/dist/type/common/plugin.d.ts.map +0 -1
- package/dist/type/common/resolver.d.ts.map +0 -1
- package/dist/type/common/rspack.d.ts.map +0 -1
- package/dist/type/common/summary.d.ts.map +0 -1
- package/dist/type/common/time.d.ts.map +0 -1
- package/dist/type/common/url.d.ts.map +0 -1
- package/dist/type/error/error.d.ts.map +0 -1
- package/dist/type/error/index.d.ts.map +0 -1
- package/dist/type/error/transform.d.ts.map +0 -1
- package/dist/type/error/utils.d.ts.map +0 -1
- package/dist/type/index.d.ts +0 -3
- package/dist/type/index.d.ts.map +0 -1
- package/dist/type/logger.d.ts.map +0 -1
- package/dist/type/rule-utils/document/document.d.ts.map +0 -1
- package/dist/type/rule-utils/document/index.d.ts.map +0 -1
- package/dist/type/rule-utils/document/server.d.ts.map +0 -1
- package/dist/type/rule-utils/document/types.d.ts.map +0 -1
- package/dist/type/rule-utils/index.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/asserts.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/index.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/parser.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/types.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/utils.d.ts.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2010 Sencha Inc.
|
|
4
|
+
Copyright (c) 2011 LearnBoost
|
|
5
|
+
Copyright (c) 2011-2014 TJ Holowaychuk
|
|
6
|
+
Copyright (c) 2015 Douglas Christopher Wilson
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
9
|
+
a copy of this software and associated documentation files (the
|
|
10
|
+
'Software'), to deal in the Software without restriction, including
|
|
11
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
13
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
14
|
+
the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be
|
|
17
|
+
included in all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
20
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
22
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
23
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
24
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
25
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"connect","author":"TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)","version":"3.7.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
interface FileSizeOptionsBase {
|
|
2
|
+
base?: 10 | 2;
|
|
3
|
+
bits?: boolean;
|
|
4
|
+
exponent?: number;
|
|
5
|
+
fullform?: boolean;
|
|
6
|
+
fullforms?: string[];
|
|
7
|
+
locale?: string | boolean;
|
|
8
|
+
localeOptions?: Intl.DateTimeFormatOptions;
|
|
9
|
+
pad?: boolean;
|
|
10
|
+
precision?: number;
|
|
11
|
+
round?: number;
|
|
12
|
+
roundingMethod?: 'round' | 'floor' | 'ceil';
|
|
13
|
+
separator?: string;
|
|
14
|
+
spacer?: string;
|
|
15
|
+
standard?: 'si' | 'iec' | 'jedec';
|
|
16
|
+
symbols?: {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface FileSizeOptionsArray extends FileSizeOptionsBase {
|
|
20
|
+
output: 'array'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface FileSizeOptionsExponent extends FileSizeOptionsBase {
|
|
24
|
+
output: 'exponent'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface FileSizeOptionsObject extends FileSizeOptionsBase {
|
|
28
|
+
output: 'object'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface FileSizeOptionsString extends FileSizeOptionsBase {
|
|
32
|
+
output: 'string'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface FileSizeReturnObject {
|
|
36
|
+
value: string,
|
|
37
|
+
symbol: string,
|
|
38
|
+
exponent: number,
|
|
39
|
+
unit: string,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type FileSizeReturnArray = [ number, string ]
|
|
43
|
+
|
|
44
|
+
type FileSizeOptionStringOrBase = FileSizeOptionsString | FileSizeOptionsBase;
|
|
45
|
+
type FileSizeOptions = FileSizeOptionsArray | FileSizeOptionsExponent | FileSizeOptionsObject | FileSizeOptionStringOrBase | undefined
|
|
46
|
+
type FileSizeReturnType<Options extends FileSizeOptions> =
|
|
47
|
+
Options extends FileSizeOptionsArray
|
|
48
|
+
? FileSizeReturnArray
|
|
49
|
+
: Options extends FileSizeOptionsExponent
|
|
50
|
+
? number
|
|
51
|
+
: Options extends FileSizeOptionsObject
|
|
52
|
+
? FileSizeReturnObject
|
|
53
|
+
: string;
|
|
54
|
+
|
|
55
|
+
declare function filesize<Options extends FileSizeOptions = undefined>(byteCount: number | string | bigint, options?: Options): FileSizeReturnType<Options>
|
|
56
|
+
declare function partial<Options extends FileSizeOptions = undefined>(options?: Options): (byteCount: number | string | bigint) => FileSizeReturnType<Options>
|
|
57
|
+
|
|
58
|
+
export { filesize, partial };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ /* webpack/runtime/compat */
|
|
4
|
+
/******/
|
|
5
|
+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
var __webpack_exports__ = {};
|
|
9
|
+
// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
|
|
10
|
+
(() => {
|
|
11
|
+
var exports = __webpack_exports__;
|
|
12
|
+
/**
|
|
13
|
+
* filesize
|
|
14
|
+
*
|
|
15
|
+
* @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
16
|
+
* @license BSD-3-Clause
|
|
17
|
+
* @version 10.1.6
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const ARRAY = "array";
|
|
22
|
+
const BIT = "bit";
|
|
23
|
+
const BITS = "bits";
|
|
24
|
+
const BYTE = "byte";
|
|
25
|
+
const BYTES = "bytes";
|
|
26
|
+
const EMPTY = "";
|
|
27
|
+
const EXPONENT = "exponent";
|
|
28
|
+
const FUNCTION = "function";
|
|
29
|
+
const IEC = "iec";
|
|
30
|
+
const INVALID_NUMBER = "Invalid number";
|
|
31
|
+
const INVALID_ROUND = "Invalid rounding method";
|
|
32
|
+
const JEDEC = "jedec";
|
|
33
|
+
const OBJECT = "object";
|
|
34
|
+
const PERIOD = ".";
|
|
35
|
+
const ROUND = "round";
|
|
36
|
+
const S = "s";
|
|
37
|
+
const SI = "si";
|
|
38
|
+
const SI_KBIT = "kbit";
|
|
39
|
+
const SI_KBYTE = "kB";
|
|
40
|
+
const SPACE = " ";
|
|
41
|
+
const STRING = "string";
|
|
42
|
+
const ZERO = "0";
|
|
43
|
+
const STRINGS = {
|
|
44
|
+
symbol: {
|
|
45
|
+
iec: {
|
|
46
|
+
bits: ["bit", "Kibit", "Mibit", "Gibit", "Tibit", "Pibit", "Eibit", "Zibit", "Yibit"],
|
|
47
|
+
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
|
|
48
|
+
},
|
|
49
|
+
jedec: {
|
|
50
|
+
bits: ["bit", "Kbit", "Mbit", "Gbit", "Tbit", "Pbit", "Ebit", "Zbit", "Ybit"],
|
|
51
|
+
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
fullform: {
|
|
55
|
+
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
|
|
56
|
+
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
function filesize (arg, {
|
|
61
|
+
bits = false,
|
|
62
|
+
pad = false,
|
|
63
|
+
base = -1,
|
|
64
|
+
round = 2,
|
|
65
|
+
locale = EMPTY,
|
|
66
|
+
localeOptions = {},
|
|
67
|
+
separator = EMPTY,
|
|
68
|
+
spacer = SPACE,
|
|
69
|
+
symbols = {},
|
|
70
|
+
standard = EMPTY,
|
|
71
|
+
output = STRING,
|
|
72
|
+
fullform = false,
|
|
73
|
+
fullforms = [],
|
|
74
|
+
exponent = -1,
|
|
75
|
+
roundingMethod = ROUND,
|
|
76
|
+
precision = 0
|
|
77
|
+
} = {}) {
|
|
78
|
+
let e = exponent,
|
|
79
|
+
num = Number(arg),
|
|
80
|
+
result = [],
|
|
81
|
+
val = 0,
|
|
82
|
+
u = EMPTY;
|
|
83
|
+
|
|
84
|
+
// Sync base & standard
|
|
85
|
+
if (standard === SI) {
|
|
86
|
+
base = 10;
|
|
87
|
+
standard = JEDEC;
|
|
88
|
+
} else if (standard === IEC || standard === JEDEC) {
|
|
89
|
+
base = 2;
|
|
90
|
+
} else if (base === 2) {
|
|
91
|
+
standard = IEC;
|
|
92
|
+
} else {
|
|
93
|
+
base = 10;
|
|
94
|
+
standard = JEDEC;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const ceil = base === 10 ? 1000 : 1024,
|
|
98
|
+
full = fullform === true,
|
|
99
|
+
neg = num < 0,
|
|
100
|
+
roundingFunc = Math[roundingMethod];
|
|
101
|
+
|
|
102
|
+
if (typeof arg !== "bigint" && isNaN(arg)) {
|
|
103
|
+
throw new TypeError(INVALID_NUMBER);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (typeof roundingFunc !== FUNCTION) {
|
|
107
|
+
throw new TypeError(INVALID_ROUND);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Flipping a negative number to determine the size
|
|
111
|
+
if (neg) {
|
|
112
|
+
num = -num;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Determining the exponent
|
|
116
|
+
if (e === -1 || isNaN(e)) {
|
|
117
|
+
e = Math.floor(Math.log(num) / Math.log(ceil));
|
|
118
|
+
|
|
119
|
+
if (e < 0) {
|
|
120
|
+
e = 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Exceeding supported length, time to reduce & multiply
|
|
125
|
+
if (e > 8) {
|
|
126
|
+
if (precision > 0) {
|
|
127
|
+
precision += 8 - e;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
e = 8;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (output === EXPONENT) {
|
|
134
|
+
return e;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Zero is now a special case because bytes divide by 1
|
|
138
|
+
if (num === 0) {
|
|
139
|
+
result[0] = 0;
|
|
140
|
+
u = result[1] = STRINGS.symbol[standard][bits ? BITS : BYTES][e];
|
|
141
|
+
} else {
|
|
142
|
+
val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
|
|
143
|
+
|
|
144
|
+
if (bits) {
|
|
145
|
+
val = val * 8;
|
|
146
|
+
|
|
147
|
+
if (val >= ceil && e < 8) {
|
|
148
|
+
val = val / ceil;
|
|
149
|
+
e++;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const p = Math.pow(10, e > 0 ? round : 0);
|
|
154
|
+
result[0] = roundingFunc(val * p) / p;
|
|
155
|
+
|
|
156
|
+
if (result[0] === ceil && e < 8 && exponent === -1) {
|
|
157
|
+
result[0] = 1;
|
|
158
|
+
e++;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
u = result[1] = base === 10 && e === 1 ? bits ? SI_KBIT : SI_KBYTE : STRINGS.symbol[standard][bits ? BITS : BYTES][e];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Decorating a 'diff'
|
|
165
|
+
if (neg) {
|
|
166
|
+
result[0] = -result[0];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Setting optional precision
|
|
170
|
+
if (precision > 0) {
|
|
171
|
+
result[0] = result[0].toPrecision(precision);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Applying custom symbol
|
|
175
|
+
result[1] = symbols[result[1]] || result[1];
|
|
176
|
+
|
|
177
|
+
if (locale === true) {
|
|
178
|
+
result[0] = result[0].toLocaleString();
|
|
179
|
+
} else if (locale.length > 0) {
|
|
180
|
+
result[0] = result[0].toLocaleString(locale, localeOptions);
|
|
181
|
+
} else if (separator.length > 0) {
|
|
182
|
+
result[0] = result[0].toString().replace(PERIOD, separator);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (pad && round > 0) {
|
|
186
|
+
const i = result[0].toString(),
|
|
187
|
+
x = separator || ((i.match(/(\D)/g) || []).pop() || PERIOD),
|
|
188
|
+
tmp = i.toString().split(x),
|
|
189
|
+
s = tmp[1] || EMPTY,
|
|
190
|
+
l = s.length,
|
|
191
|
+
n = round - l;
|
|
192
|
+
|
|
193
|
+
result[0] = `${tmp[0]}${x}${s.padEnd(l + n, ZERO)}`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (full) {
|
|
197
|
+
result[1] = fullforms[e] ? fullforms[e] : STRINGS.fullform[standard][e] + (bits ? BIT : BYTE) + (result[0] === 1 ? EMPTY : S);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Returning Array, Object, or String (default)
|
|
201
|
+
return output === ARRAY ? result : output === OBJECT ? {
|
|
202
|
+
value: result[0],
|
|
203
|
+
symbol: result[1],
|
|
204
|
+
exponent: e,
|
|
205
|
+
unit: u
|
|
206
|
+
} : result.join(spacer);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Partial application for functional programming
|
|
210
|
+
function partial ({
|
|
211
|
+
bits = false,
|
|
212
|
+
pad = false,
|
|
213
|
+
base = -1,
|
|
214
|
+
round = 2,
|
|
215
|
+
locale = EMPTY,
|
|
216
|
+
localeOptions = {},
|
|
217
|
+
separator = EMPTY,
|
|
218
|
+
spacer = SPACE,
|
|
219
|
+
symbols = {},
|
|
220
|
+
standard = EMPTY,
|
|
221
|
+
output = STRING,
|
|
222
|
+
fullform = false,
|
|
223
|
+
fullforms = [],
|
|
224
|
+
exponent = -1,
|
|
225
|
+
roundingMethod = ROUND,
|
|
226
|
+
precision = 0
|
|
227
|
+
} = {}) {
|
|
228
|
+
return arg => filesize(arg, {
|
|
229
|
+
bits,
|
|
230
|
+
pad,
|
|
231
|
+
base,
|
|
232
|
+
round,
|
|
233
|
+
locale,
|
|
234
|
+
localeOptions,
|
|
235
|
+
separator,
|
|
236
|
+
spacer,
|
|
237
|
+
symbols,
|
|
238
|
+
standard,
|
|
239
|
+
output,
|
|
240
|
+
fullform,
|
|
241
|
+
fullforms,
|
|
242
|
+
exponent,
|
|
243
|
+
roundingMethod,
|
|
244
|
+
precision
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
exports.filesize = filesize;
|
|
249
|
+
exports.partial = partial;
|
|
250
|
+
|
|
251
|
+
})();
|
|
252
|
+
|
|
253
|
+
module.exports = __webpack_exports__;
|
|
254
|
+
/******/ })()
|
|
255
|
+
;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Copyright (c) 2024, Jason Mulligan
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of filesize nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"filesize","author":"Jason Mulligan <jason.mulligan@avoidwork.com>","version":"10.1.6","license":"BSD-3-Clause","types":"index.d.ts","type":"commonjs"}
|
|
@@ -11,4 +11,3 @@ export declare function getGlobalNpmPackageVersion(pkg: string): Promise<string>
|
|
|
11
11
|
export declare function getGlobalNpmPackageVersion(pkgs: string[]): Promise<string[]>;
|
|
12
12
|
export declare function getGitBranch(): Promise<string>;
|
|
13
13
|
export declare function getGitRepo(): Promise<string>;
|
|
14
|
-
//# sourceMappingURL=envinfo.d.ts.map
|
|
@@ -3,4 +3,3 @@ export declare function readFile(path: string): Promise<string>;
|
|
|
3
3
|
export declare function readFileSync(path: string): string;
|
|
4
4
|
export declare function readJSON<T extends Common.PlainObject>(path: string): Promise<T>;
|
|
5
5
|
export declare function readJSONSync<T extends Common.PlainObject>(path: string): T;
|
|
6
|
-
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
2
|
export declare function stringify<T, P = T extends undefined ? undefined : string>(json: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number, cycle?: boolean): Promise<P>;
|
|
3
3
|
export declare const readPackageJson: (file: string, readFile?: SDK.GetPackageFile) => SDK.PackageBasicData | undefined;
|
|
4
|
-
//# sourceMappingURL=json.d.ts.map
|