@modern-js/utils 1.3.4 → 1.3.7-alpha.prebundle.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +9 -0
- package/CHANGELOG.md +18 -0
- package/compiled/browserslist/index.d.ts +178 -0
- package/compiled/browserslist/index.js +1 -0
- package/compiled/browserslist/license +20 -0
- package/compiled/browserslist/package.json +1 -0
- package/compiled/chalk/index.d.ts +415 -0
- package/compiled/chalk/index.js +1 -0
- package/compiled/chalk/license +9 -0
- package/compiled/chalk/package.json +1 -0
- package/compiled/chokidar/anymatch/index.d.ts +19 -0
- package/compiled/chokidar/fsevents.node +0 -0
- package/compiled/chokidar/index.js +40 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/chokidar/types/index.d.ts +188 -0
- package/compiled/commander/index.js +1 -0
- package/compiled/commander/license +22 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/commander/typings/index.d.ts +774 -0
- package/compiled/debug/index.d.ts +54 -0
- package/compiled/debug/index.js +1 -0
- package/compiled/debug/license +20 -0
- package/compiled/debug/ms/index.d.ts +25 -0
- package/compiled/debug/package.json +1 -0
- package/compiled/execa/index.d.ts +564 -0
- package/compiled/execa/index.js +1 -0
- package/compiled/execa/license +9 -0
- package/compiled/execa/package.json +1 -0
- package/compiled/filesize/filesize.d.ts +131 -0
- package/compiled/filesize/index.js +9 -0
- package/compiled/filesize/license +28 -0
- package/compiled/filesize/package.json +1 -0
- package/compiled/fs-extra/index.d.ts +563 -0
- package/compiled/fs-extra/index.js +1 -0
- package/compiled/fs-extra/license +15 -0
- package/compiled/fs-extra/package.json +1 -0
- package/compiled/glob/index.d.ts +91 -0
- package/compiled/glob/index.js +1 -0
- package/compiled/glob/license +21 -0
- package/compiled/glob/minimatch/index.d.ts +204 -0
- package/compiled/glob/package.json +1 -0
- package/compiled/gzip-size/index.d.ts +96 -0
- package/compiled/gzip-size/index.js +1 -0
- package/compiled/gzip-size/license +9 -0
- package/compiled/gzip-size/package.json +1 -0
- package/compiled/import-lazy/index.d.ts +26 -0
- package/compiled/import-lazy/index.js +1 -0
- package/compiled/import-lazy/license +9 -0
- package/compiled/import-lazy/package.json +1 -0
- package/compiled/js-yaml/index.d.ts +154 -0
- package/compiled/js-yaml/index.js +1 -0
- package/compiled/js-yaml/license +21 -0
- package/compiled/js-yaml/package.json +1 -0
- package/compiled/lodash/common/array.d.ts +2126 -0
- package/compiled/lodash/common/collection.d.ts +1930 -0
- package/compiled/lodash/common/common.d.ts +280 -0
- package/compiled/lodash/common/date.d.ts +23 -0
- package/compiled/lodash/common/function.d.ts +1446 -0
- package/compiled/lodash/common/lang.d.ts +1693 -0
- package/compiled/lodash/common/math.d.ts +405 -0
- package/compiled/lodash/common/number.d.ts +131 -0
- package/compiled/lodash/common/object.d.ts +2519 -0
- package/compiled/lodash/common/seq.d.ts +210 -0
- package/compiled/lodash/common/string.d.ts +788 -0
- package/compiled/lodash/common/util.d.ts +1220 -0
- package/compiled/lodash/index.d.ts +46 -0
- package/compiled/lodash/index.js +9 -0
- package/compiled/lodash/license +47 -0
- package/compiled/lodash/package.json +1 -0
- package/compiled/pkg-up/index.d.ts +48 -0
- package/compiled/pkg-up/index.js +1 -0
- package/compiled/pkg-up/license +9 -0
- package/compiled/pkg-up/package.json +1 -0
- package/compiled/recursive-readdir/index.d.ts +21 -0
- package/compiled/recursive-readdir/index.js +1 -0
- package/compiled/recursive-readdir/license +21 -0
- package/compiled/recursive-readdir/package.json +1 -0
- package/compiled/signale/index.d.ts +162 -0
- package/compiled/signale/index.js +1 -0
- package/compiled/signale/package.json +1 -0
- package/compiled/strip-ansi/index.d.ts +17 -0
- package/compiled/strip-ansi/index.js +1 -0
- package/compiled/strip-ansi/license +9 -0
- package/compiled/strip-ansi/package.json +1 -0
- package/compiled/upath/index.js +1 -0
- package/compiled/upath/license +22 -0
- package/compiled/upath/package.json +1 -0
- package/compiled/upath/upath.d.ts +241 -0
- package/dist/{types/FileSizeReporter.d.ts → FileSizeReporter.d.ts} +5 -5
- package/dist/FileSizeReporter.js +151 -0
- package/dist/{types/alias.d.ts → alias.d.ts} +12 -14
- package/dist/alias.js +62 -0
- package/dist/applyOptionsChain.d.ts +6 -0
- package/dist/applyOptionsChain.js +30 -0
- package/dist/clearConsole.d.ts +1 -0
- package/dist/clearConsole.js +9 -0
- package/dist/{types/compatRequire.d.ts → compatRequire.d.ts} +1 -1
- package/dist/compatRequire.js +28 -0
- package/dist/compiled/upath/index.d.ts +225 -0
- package/dist/compiled/upath/index.js +1 -0
- package/dist/compiled.d.ts +21 -0
- package/dist/compiled.js +33 -0
- package/dist/constants.d.ts +209 -0
- package/dist/constants.js +264 -0
- package/dist/{js/modern/debug.js → debug.d.ts} +1 -3
- package/dist/debug.js +11 -0
- package/dist/emptyDir.d.ts +1 -0
- package/dist/emptyDir.js +19 -0
- package/dist/{types/ensureAbsolutePath.d.ts → ensureAbsolutePath.d.ts} +1 -1
- package/dist/ensureAbsolutePath.js +15 -0
- package/dist/{types/findExists.d.ts → findExists.d.ts} +1 -1
- package/dist/findExists.js +21 -0
- package/dist/{types/format.d.ts → format.d.ts} +5 -5
- package/dist/format.js +113 -0
- package/dist/{types/generateMetaTags.d.ts → generateMetaTags.d.ts} +3 -3
- package/dist/generateMetaTags.js +48 -0
- package/dist/{types/getBrowserslist.d.ts → getBrowserslist.d.ts} +1 -1
- package/dist/getBrowserslist.js +7 -0
- package/dist/{types/getCacheIdentifier.d.ts → getCacheIdentifier.d.ts} +3 -3
- package/dist/getCacheIdentifier.js +24 -0
- package/dist/{types/getEntryOptions.d.ts → getEntryOptions.d.ts} +1 -1
- package/dist/getEntryOptions.js +26 -0
- package/dist/{types/getPackageManager.d.ts → getPackageManager.d.ts} +1 -1
- package/dist/getPackageManager.js +47 -0
- package/dist/{types/getPort.d.ts → getPort.d.ts} +1 -1
- package/dist/getPort.js +62 -0
- package/dist/{types/import.d.ts → import.d.ts} +2 -2
- package/dist/import.js +10 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +43 -0
- package/dist/{types/is → is}/index.d.ts +1 -4
- package/dist/is/index.js +82 -0
- package/dist/{types/is → is}/node-env.d.ts +1 -1
- package/dist/is/node-env.js +12 -0
- package/dist/is/platform.d.ts +2 -0
- package/dist/is/platform.js +10 -0
- package/dist/is/type.d.ts +8 -0
- package/dist/is/type.js +38 -0
- package/dist/logger.d.ts +63 -0
- package/dist/logger.js +128 -0
- package/dist/{types/monorepo.d.ts → monorepo.d.ts} +3 -3
- package/dist/monorepo.js +80 -0
- package/dist/{types/nodeEnv.d.ts → nodeEnv.d.ts} +1 -1
- package/dist/nodeEnv.js +49 -0
- package/dist/{types/path.d.ts → path.d.ts} +1 -1
- package/dist/path.js +14 -0
- package/dist/{types/pkgUp.d.ts → pkgUp.d.ts} +1 -1
- package/dist/pkgUp.js +8 -0
- package/dist/{types/prettyInstructions.d.ts → prettyInstructions.d.ts} +2 -2
- package/dist/prettyInstructions.js +64 -0
- package/dist/{types/printBuildError.d.ts → printBuildError.d.ts} +1 -1
- package/dist/printBuildError.js +43 -0
- package/dist/{types/readTsConfig.d.ts → readTsConfig.d.ts} +1 -1
- package/dist/readTsConfig.js +19 -0
- package/dist/{types/removeSlash.d.ts → removeSlash.d.ts} +1 -1
- package/dist/removeSlash.js +9 -0
- package/dist/{types/runtimeExports.d.ts → runtimeExports.d.ts} +3 -3
- package/dist/runtimeExports.js +53 -0
- package/dist/src/FileSizeReporter.d.ts +16 -0
- package/dist/src/FileSizeReporter.js +152 -0
- package/dist/src/alias.d.ts +21 -0
- package/dist/src/alias.js +62 -0
- package/dist/src/applyOptionsChain.d.ts +6 -0
- package/dist/src/applyOptionsChain.js +30 -0
- package/dist/src/clearConsole.d.ts +1 -0
- package/dist/src/clearConsole.js +9 -0
- package/dist/src/compatRequire.d.ts +8 -0
- package/dist/src/compatRequire.js +28 -0
- package/dist/src/compiled.d.ts +7 -0
- package/dist/src/compiled.js +19 -0
- package/dist/src/constants.d.ts +209 -0
- package/dist/src/constants.js +264 -0
- package/dist/{types → src}/debug.d.ts +1 -2
- package/dist/src/debug.js +14 -0
- package/dist/src/emptyDir.d.ts +1 -0
- package/dist/src/emptyDir.js +22 -0
- package/dist/{js/modern/ensureAbsolutePath.js → src/ensureAbsolutePath.d.ts} +1 -3
- package/dist/src/ensureAbsolutePath.js +15 -0
- package/dist/src/findExists.d.ts +6 -0
- package/dist/src/findExists.js +21 -0
- package/dist/src/format.d.ts +16 -0
- package/dist/src/format.js +115 -0
- package/dist/src/generateMetaTags.d.ts +16 -0
- package/dist/src/generateMetaTags.js +48 -0
- package/dist/src/getBrowserslist.d.ts +2 -0
- package/dist/src/getBrowserslist.js +7 -0
- package/dist/src/getCacheIdentifier.d.ts +7 -0
- package/dist/src/getCacheIdentifier.js +24 -0
- package/dist/src/getEntryOptions.d.ts +1 -0
- package/dist/src/getEntryOptions.js +26 -0
- package/dist/src/getPackageManager.d.ts +1 -0
- package/dist/src/getPackageManager.js +47 -0
- package/dist/src/getPort.d.ts +7 -0
- package/dist/src/getPort.js +62 -0
- package/dist/src/import.d.ts +5 -0
- package/dist/src/import.js +10 -0
- package/dist/{types → src}/index.d.ts +2 -3
- package/dist/src/index.js +57 -0
- package/dist/src/is/index.d.ts +34 -0
- package/dist/src/is/index.js +82 -0
- package/dist/src/is/node-env.d.ts +4 -0
- package/dist/src/is/node-env.js +12 -0
- package/dist/src/is/platform.d.ts +2 -0
- package/dist/src/is/platform.js +10 -0
- package/dist/src/is/type.d.ts +8 -0
- package/dist/src/is/type.js +38 -0
- package/dist/src/logger.d.ts +63 -0
- package/dist/src/logger.js +129 -0
- package/dist/src/monorepo.d.ts +11 -0
- package/dist/src/monorepo.js +81 -0
- package/dist/src/nodeEnv.d.ts +3 -0
- package/dist/src/nodeEnv.js +52 -0
- package/dist/src/path.d.ts +3 -0
- package/dist/src/path.js +14 -0
- package/dist/src/prettyInstructions.d.ts +6 -0
- package/dist/src/prettyInstructions.js +64 -0
- package/dist/src/printBuildError.d.ts +8 -0
- package/dist/src/printBuildError.js +43 -0
- package/dist/src/readTsConfig.d.ts +2 -0
- package/dist/src/readTsConfig.js +19 -0
- package/dist/src/removeSlash.d.ts +3 -0
- package/dist/src/removeSlash.js +9 -0
- package/dist/src/runtimeExports.d.ts +4 -0
- package/dist/src/runtimeExports.js +53 -0
- package/dist/{types → src}/wait.d.ts +1 -1
- package/dist/src/wait.js +7 -0
- package/dist/{types → src}/watch.d.ts +3 -3
- package/dist/src/watch.js +65 -0
- package/dist/wait.d.ts +2 -0
- package/dist/wait.js +7 -0
- package/dist/watch.d.ts +8 -0
- package/dist/watch.js +64 -0
- package/jest.config.js +0 -1
- package/package.json +55 -39
- package/tests/debug.test.ts +2 -2
- package/tests/is.test.ts +27 -0
- package/tests/isPlatform.test.ts +19 -0
- package/tests/isType.test.ts +70 -2
- package/tests/prettyInstructions.test.ts +1 -1
- package/tsconfig.json +3 -5
- package/dist/js/modern/FileSizeReporter.js +0 -156
- package/dist/js/modern/alias.js +0 -74
- package/dist/js/modern/applyOptionsChain.js +0 -27
- package/dist/js/modern/chalk.js +0 -2
- package/dist/js/modern/clearConsole.js +0 -5
- package/dist/js/modern/compatRequire.js +0 -26
- package/dist/js/modern/constants.js +0 -338
- package/dist/js/modern/emptyDir.js +0 -6
- package/dist/js/modern/findExists.js +0 -16
- package/dist/js/modern/format.js +0 -137
- package/dist/js/modern/generateMetaTags.js +0 -49
- package/dist/js/modern/getBrowserslist.js +0 -5
- package/dist/js/modern/getCacheIdentifier.js +0 -20
- package/dist/js/modern/getEntryOptions.js +0 -24
- package/dist/js/modern/getPackageManager.js +0 -37
- package/dist/js/modern/getPort.js +0 -52
- package/dist/js/modern/import.js +0 -11
- package/dist/js/modern/index.js +0 -34
- package/dist/js/modern/is/index.js +0 -77
- package/dist/js/modern/is/node-env.js +0 -5
- package/dist/js/modern/is/platform.js +0 -2
- package/dist/js/modern/is/type.js +0 -28
- package/dist/js/modern/logger.js +0 -152
- package/dist/js/modern/monorepo.js +0 -84
- package/dist/js/modern/nodeEnv.js +0 -31
- package/dist/js/modern/path.js +0 -5
- package/dist/js/modern/pkgUp.js +0 -2
- package/dist/js/modern/prettyInstructions.js +0 -79
- package/dist/js/modern/printBuildError.js +0 -40
- package/dist/js/modern/readTsConfig.js +0 -13
- package/dist/js/modern/removeSlash.js +0 -3
- package/dist/js/modern/runtimeExports.js +0 -52
- package/dist/js/modern/wait.js +0 -5
- package/dist/js/modern/watch.js +0 -43
- package/dist/js/node/FileSizeReporter.js +0 -175
- package/dist/js/node/alias.js +0 -97
- package/dist/js/node/applyOptionsChain.js +0 -37
- package/dist/js/node/chalk.js +0 -15
- package/dist/js/node/clearConsole.js +0 -14
- package/dist/js/node/compatRequire.js +0 -41
- package/dist/js/node/constants.js +0 -358
- package/dist/js/node/debug.js +0 -19
- package/dist/js/node/emptyDir.js +0 -18
- package/dist/js/node/ensureAbsolutePath.js +0 -20
- package/dist/js/node/findExists.js +0 -27
- package/dist/js/node/format.js +0 -141
- package/dist/js/node/generateMetaTags.js +0 -58
- package/dist/js/node/getBrowserslist.js +0 -17
- package/dist/js/node/getCacheIdentifier.js +0 -27
- package/dist/js/node/getEntryOptions.js +0 -35
- package/dist/js/node/getPackageManager.js +0 -51
- package/dist/js/node/getPort.js +0 -67
- package/dist/js/node/import.js +0 -19
- package/dist/js/node/index.js +0 -465
- package/dist/js/node/is/index.js +0 -150
- package/dist/js/node/is/node-env.js +0 -23
- package/dist/js/node/is/platform.js +0 -14
- package/dist/js/node/is/type.js +0 -49
- package/dist/js/node/logger.js +0 -162
- package/dist/js/node/monorepo.js +0 -118
- package/dist/js/node/nodeEnv.js +0 -45
- package/dist/js/node/path.js +0 -24
- package/dist/js/node/pkgUp.js +0 -15
- package/dist/js/node/prettyInstructions.js +0 -95
- package/dist/js/node/printBuildError.js +0 -52
- package/dist/js/node/readTsConfig.js +0 -28
- package/dist/js/node/removeSlash.js +0 -18
- package/dist/js/node/runtimeExports.js +0 -68
- package/dist/js/node/wait.js +0 -12
- package/dist/js/node/watch.js +0 -61
- package/dist/js/treeshaking/FileSizeReporter.js +0 -185
- package/dist/js/treeshaking/alias.js +0 -72
- package/dist/js/treeshaking/applyOptionsChain.js +0 -31
- package/dist/js/treeshaking/chalk.js +0 -2
- package/dist/js/treeshaking/clearConsole.js +0 -5
- package/dist/js/treeshaking/compatRequire.js +0 -29
- package/dist/js/treeshaking/constants.js +0 -338
- package/dist/js/treeshaking/debug.js +0 -10
- package/dist/js/treeshaking/emptyDir.js +0 -37
- package/dist/js/treeshaking/ensureAbsolutePath.js +0 -11
- package/dist/js/treeshaking/findExists.js +0 -33
- package/dist/js/treeshaking/format.js +0 -167
- package/dist/js/treeshaking/generateMetaTags.js +0 -55
- package/dist/js/treeshaking/getBrowserslist.js +0 -7
- package/dist/js/treeshaking/getCacheIdentifier.js +0 -35
- package/dist/js/treeshaking/getEntryOptions.js +0 -26
- package/dist/js/treeshaking/getPackageManager.js +0 -101
- package/dist/js/treeshaking/getPort.js +0 -103
- package/dist/js/treeshaking/import.js +0 -11
- package/dist/js/treeshaking/index.js +0 -34
- package/dist/js/treeshaking/is/index.js +0 -81
- package/dist/js/treeshaking/is/node-env.js +0 -13
- package/dist/js/treeshaking/is/platform.js +0 -6
- package/dist/js/treeshaking/is/type.js +0 -30
- package/dist/js/treeshaking/logger.js +0 -188
- package/dist/js/treeshaking/monorepo.js +0 -95
- package/dist/js/treeshaking/nodeEnv.js +0 -108
- package/dist/js/treeshaking/path.js +0 -11
- package/dist/js/treeshaking/pkgUp.js +0 -2
- package/dist/js/treeshaking/prettyInstructions.js +0 -100
- package/dist/js/treeshaking/printBuildError.js +0 -40
- package/dist/js/treeshaking/readTsConfig.js +0 -13
- package/dist/js/treeshaking/removeSlash.js +0 -9
- package/dist/js/treeshaking/runtimeExports.js +0 -61
- package/dist/js/treeshaking/wait.js +0 -8
- package/dist/js/treeshaking/watch.js +0 -112
- package/dist/types/applyOptionsChain.d.ts +0 -6
- package/dist/types/chalk.d.ts +0 -2
- package/dist/types/clearConsole.d.ts +0 -1
- package/dist/types/constants.d.ts +0 -219
- package/dist/types/emptyDir.d.ts +0 -1
- package/dist/types/is/platform.d.ts +0 -2
- package/dist/types/is/type.d.ts +0 -8
- package/dist/types/logger.d.ts +0 -63
@@ -0,0 +1,131 @@
|
|
1
|
+
// Type definitions for filesize 8.0.3
|
2
|
+
// Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com
|
3
|
+
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
|
4
|
+
// Renaud Chaput <https://github.com/renchap>
|
5
|
+
// Roman Nuritdinov <https://github.com/Ky6uk>
|
6
|
+
// Sam Hulick <https://github.com/ffxsam>
|
7
|
+
// Tomoto S. Washio <https://github.com/tomoto>
|
8
|
+
|
9
|
+
declare var fileSize: Filesize.Filesize;
|
10
|
+
export = fileSize;
|
11
|
+
export as namespace filesize;
|
12
|
+
|
13
|
+
declare namespace Filesize {
|
14
|
+
interface SiJedecBits {
|
15
|
+
b?: string;
|
16
|
+
Kb?: string;
|
17
|
+
Mb?: string;
|
18
|
+
Gb?: string;
|
19
|
+
Tb?: string;
|
20
|
+
Pb?: string;
|
21
|
+
Eb?: string;
|
22
|
+
Zb?: string;
|
23
|
+
Yb?: string;
|
24
|
+
}
|
25
|
+
|
26
|
+
interface SiJedecBytes {
|
27
|
+
B?: string;
|
28
|
+
KB?: string;
|
29
|
+
MB?: string;
|
30
|
+
GB?: string;
|
31
|
+
TB?: string;
|
32
|
+
PB?: string;
|
33
|
+
EB?: string;
|
34
|
+
ZB?: string;
|
35
|
+
YB?: string;
|
36
|
+
}
|
37
|
+
|
38
|
+
type SiJedec = SiJedecBits & SiJedecBytes & { [name: string]: string };
|
39
|
+
|
40
|
+
interface Options {
|
41
|
+
/**
|
42
|
+
* Number base, default is 10
|
43
|
+
*/
|
44
|
+
base?: number;
|
45
|
+
/**
|
46
|
+
* Enables bit sizes, default is false
|
47
|
+
*/
|
48
|
+
bits?: boolean;
|
49
|
+
/**
|
50
|
+
* Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1
|
51
|
+
*/
|
52
|
+
exponent?: number;
|
53
|
+
/**
|
54
|
+
* Enables full form of unit of measure, default is false
|
55
|
+
*/
|
56
|
+
fullform?: boolean;
|
57
|
+
/**
|
58
|
+
* Array of full form overrides, default is []
|
59
|
+
*/
|
60
|
+
fullforms?: string[];
|
61
|
+
/**
|
62
|
+
* BCP 47 language tag to specify a locale, or true to use default locale, default is ""
|
63
|
+
*/
|
64
|
+
locale?: string | boolean;
|
65
|
+
/**
|
66
|
+
* ECMA-402 number format option overrides, default is "{}"
|
67
|
+
*/
|
68
|
+
localeOptions?: Intl.NumberFormatOptions;
|
69
|
+
/**
|
70
|
+
* Output of function (array, exponent, object, or string), default is string
|
71
|
+
*/
|
72
|
+
output?: "array" | "exponent" | "object" | "string";
|
73
|
+
/**
|
74
|
+
* Decimal place end padding, default is false
|
75
|
+
*/
|
76
|
+
pad?: boolean;
|
77
|
+
/**
|
78
|
+
* Sets precision of numerical output, default is 0
|
79
|
+
*/
|
80
|
+
precision?: number;
|
81
|
+
/**
|
82
|
+
* Decimal place, default is 2
|
83
|
+
*/
|
84
|
+
round?: number;
|
85
|
+
/**
|
86
|
+
* Rounding method, can be round, floor, or ceil, default is round
|
87
|
+
*/
|
88
|
+
roundingMethod?: "round" | "floor" | "ceil";
|
89
|
+
/**
|
90
|
+
* Decimal separator character, default is `.`
|
91
|
+
*/
|
92
|
+
separator?: string;
|
93
|
+
/**
|
94
|
+
* Character between the result and suffix, default is ` `
|
95
|
+
*/
|
96
|
+
spacer?: string;
|
97
|
+
/**
|
98
|
+
* Standard unit of measure, can be iec or jedec, default is iec; can be overruled by base
|
99
|
+
*/
|
100
|
+
standard?: "iec" | "jedec";
|
101
|
+
/**
|
102
|
+
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
|
103
|
+
*/
|
104
|
+
symbols?: SiJedec;
|
105
|
+
/**
|
106
|
+
* Enables unix style human readable output, e.g ls -lh, default is false
|
107
|
+
*/
|
108
|
+
unix?: boolean;
|
109
|
+
}
|
110
|
+
|
111
|
+
// Result type inference from the output option
|
112
|
+
interface ResultTypeMap {
|
113
|
+
array: [number, string];
|
114
|
+
exponent: number;
|
115
|
+
object: {
|
116
|
+
value: number,
|
117
|
+
symbol: string,
|
118
|
+
exponent: number,
|
119
|
+
unit: string,
|
120
|
+
};
|
121
|
+
string: string;
|
122
|
+
}
|
123
|
+
type DefaultOutput<O extends Options> = Exclude<O["output"], keyof ResultTypeMap> extends never ? never : "string"
|
124
|
+
type CanonicalOutput<O extends Options> = Extract<O["output"], keyof ResultTypeMap> | DefaultOutput<O>
|
125
|
+
|
126
|
+
interface Filesize {
|
127
|
+
(bytes: number): string;
|
128
|
+
<O extends Options>(bytes: number, options: O): ResultTypeMap[CanonicalOutput<O>];
|
129
|
+
partial: <O extends Options>(options: O) => ((bytes: number) => ResultTypeMap[CanonicalOutput<O>]);
|
130
|
+
}
|
131
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
(()=>{var i={823:function(i){
|
2
|
+
/**
|
3
|
+
* filesize
|
4
|
+
*
|
5
|
+
* @copyright 2022 Jason Mulligan <jason.mulligan@avoidwork.com>
|
6
|
+
* @license BSD-3-Clause
|
7
|
+
* @version 8.0.7
|
8
|
+
*/
|
9
|
+
(function(e,t){true?i.exports=t():0})(this,(function(){"use strict";var i=/^(b|B)$/,e={iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},t={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]},r={floor:Math.floor,ceil:Math.ceil};function filesize(o){var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var n=[],s=0,f,b,l,u,c,p,d,_,B,v,h,g,x,y,M,m,w,k,N,z,E;if(isNaN(o)){throw new TypeError("Invalid number")}l=a.bits===true;M=a.unix===true;g=a.pad===true;b=a.base||10;x=a.round!==void 0?a.round:M?1:2;d=a.locale!==void 0?a.locale:"";_=a.localeOptions||{};m=a.separator!==void 0?a.separator:"";w=a.spacer!==void 0?a.spacer:M?"":" ";N=a.symbols||{};k=b===2?a.standard||"iec":"jedec";h=a.output||"string";c=a.fullform===true;p=a.fullforms instanceof Array?a.fullforms:[];f=a.exponent!==void 0?a.exponent:-1;z=r[a.roundingMethod]||Math.round;v=Number(o);B=v<0;u=b>2?1e3:1024;E=isNaN(a.precision)===false?parseInt(a.precision,10):0;if(B){v=-v}if(f===-1||isNaN(f)){f=Math.floor(Math.log(v)/Math.log(u));if(f<0){f=0}}if(f>8){if(E>0){E+=8-f}f=8}if(h==="exponent"){return f}if(v===0){n[0]=0;y=n[1]=M?"":e[k][l?"bits":"bytes"][f]}else{s=v/(b===2?Math.pow(2,f*10):Math.pow(1e3,f));if(l){s=s*8;if(s>=u&&f<8){s=s/u;f++}}var j=Math.pow(10,f>0?x:0);n[0]=z(s*j)/j;if(n[0]===u&&f<8&&a.exponent===void 0){n[0]=1;f++}y=n[1]=b===10&&f===1?l?"kbit":"kB":e[k][l?"bits":"bytes"][f];if(M){n[1]=n[1].charAt(0);if(i.test(n[1])){n[0]=Math.floor(n[0]);n[1]=""}}}if(B){n[0]=-n[0]}if(E>0){n[0]=n[0].toPrecision(E)}n[1]=N[n[1]]||n[1];if(d===true){n[0]=n[0].toLocaleString()}else if(d.length>0){n[0]=n[0].toLocaleString(d,_)}else if(m.length>0){n[0]=n[0].toString().replace(".",m)}if(g&&Number.isInteger(n[0])===false&&x>0){var q=m||".",P=n[0].toString().split(q),T=P[1]||"",G=T.length,K=x-G;n[0]="".concat(P[0]).concat(q).concat(T.padEnd(G+K,"0"))}if(c){n[1]=p[f]?p[f]:t[k][f]+(l?"bit":"byte")+(n[0]===1?"":"s")}return h==="array"?n:h==="object"?{value:n[0],symbol:n[1],exponent:f,unit:y}:n.join(w)}filesize.partial=function(i){return function(e){return filesize(e,i)}};return filesize}))}};var e={};function __nccwpck_require__(t){var r=e[t];if(r!==undefined){return r.exports}var o=e[t]={exports:{}};var a=true;try{i[t].call(o.exports,o,o.exports,__nccwpck_require__);a=false}finally{if(a)delete e[t]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(823);module.exports=t})();
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Copyright (c) 2022, 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":"8.0.7","license":"BSD-3-Clause","types":"filesize.d.ts"}
|