diff options
author | Gar <gar+gh@danger.computer> | 2021-07-22 17:49:40 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-08-11 19:36:43 +0300 |
commit | a1bdbea974ebfc6694b4c8ad5da86215c2924dde (patch) | |
tree | 3b1ab9b288ee9ed84afdcec2cb8ca7ee1f55ca46 /node_modules | |
parent | d1812f1a627d6a4d4cb6d07d7735d2d2cc2cf264 (diff) |
deps: remove byte-size
In its latest release, byte-size dropped support for node versions lower
than 14. The cli currently supports node 10 and up.
The actual functionality we needed and was using was extremely limited
in scope, and didn't warrant an external module. It's just pretty
printing a file size, and the files we are dealing with are limited in
size so we don't need to support so many suffixes.
PR-URL: https://github.com/npm/cli/pull/3569
Credit: @wraithgar
Close: #3569
Reviewed-by: @isaacs
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/byte-size/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/byte-size/dist/index.js | 123 | ||||
-rw-r--r-- | node_modules/byte-size/index.mjs | 115 | ||||
-rw-r--r-- | node_modules/byte-size/package.json | 55 |
4 files changed, 0 insertions, 314 deletions
diff --git a/node_modules/byte-size/LICENSE b/node_modules/byte-size/LICENSE deleted file mode 100644 index 5699dfbe5..000000000 --- a/node_modules/byte-size/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-21 Lloyd Brookes <75pound@gmail.com> - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -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. diff --git a/node_modules/byte-size/dist/index.js b/node_modules/byte-size/dist/index.js deleted file mode 100644 index dd1debda5..000000000 --- a/node_modules/byte-size/dist/index.js +++ /dev/null @@ -1,123 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.byteSize = factory()); -}(this, (function () { 'use strict'; - - /** - * @module byte-size - */ - - let defaultOptions = {}; - const _options = new WeakMap(); - - class ByteSize { - constructor (bytes, options) { - options = Object.assign({ - units: 'metric', - precision: 1 - }, defaultOptions, options); - _options.set(this, options); - - const tables = { - metric: [ - { from: 0 , to: 1e3 , unit: 'B' , long: 'bytes' }, - { from: 1e3 , to: 1e6 , unit: 'kB', long: 'kilobytes' }, - { from: 1e6 , to: 1e9 , unit: 'MB', long: 'megabytes' }, - { from: 1e9 , to: 1e12, unit: 'GB', long: 'gigabytes' }, - { from: 1e12, to: 1e15, unit: 'TB', long: 'terabytes' }, - { from: 1e15, to: 1e18, unit: 'PB', long: 'petabytes' }, - { from: 1e18, to: 1e21, unit: 'EB', long: 'exabytes' }, - { from: 1e21, to: 1e24, unit: 'ZB', long: 'zettabytes' }, - { from: 1e24, to: 1e27, unit: 'YB', long: 'yottabytes' }, - ], - metric_octet: [ - { from: 0 , to: 1e3 , unit: 'o' , long: 'octets' }, - { from: 1e3 , to: 1e6 , unit: 'ko', long: 'kilooctets' }, - { from: 1e6 , to: 1e9 , unit: 'Mo', long: 'megaoctets' }, - { from: 1e9 , to: 1e12, unit: 'Go', long: 'gigaoctets' }, - { from: 1e12, to: 1e15, unit: 'To', long: 'teraoctets' }, - { from: 1e15, to: 1e18, unit: 'Po', long: 'petaoctets' }, - { from: 1e18, to: 1e21, unit: 'Eo', long: 'exaoctets' }, - { from: 1e21, to: 1e24, unit: 'Zo', long: 'zettaoctets' }, - { from: 1e24, to: 1e27, unit: 'Yo', long: 'yottaoctets' }, - ], - iec: [ - { from: 0 , to: Math.pow(1024, 1), unit: 'B' , long: 'bytes' }, - { from: Math.pow(1024, 1), to: Math.pow(1024, 2), unit: 'KiB', long: 'kibibytes' }, - { from: Math.pow(1024, 2), to: Math.pow(1024, 3), unit: 'MiB', long: 'mebibytes' }, - { from: Math.pow(1024, 3), to: Math.pow(1024, 4), unit: 'GiB', long: 'gibibytes' }, - { from: Math.pow(1024, 4), to: Math.pow(1024, 5), unit: 'TiB', long: 'tebibytes' }, - { from: Math.pow(1024, 5), to: Math.pow(1024, 6), unit: 'PiB', long: 'pebibytes' }, - { from: Math.pow(1024, 6), to: Math.pow(1024, 7), unit: 'EiB', long: 'exbibytes' }, - { from: Math.pow(1024, 7), to: Math.pow(1024, 8), unit: 'ZiB', long: 'zebibytes' }, - { from: Math.pow(1024, 8), to: Math.pow(1024, 9), unit: 'YiB', long: 'yobibytes' }, - ], - iec_octet: [ - { from: 0 , to: Math.pow(1024, 1), unit: 'o' , long: 'octets' }, - { from: Math.pow(1024, 1), to: Math.pow(1024, 2), unit: 'Kio', long: 'kibioctets' }, - { from: Math.pow(1024, 2), to: Math.pow(1024, 3), unit: 'Mio', long: 'mebioctets' }, - { from: Math.pow(1024, 3), to: Math.pow(1024, 4), unit: 'Gio', long: 'gibioctets' }, - { from: Math.pow(1024, 4), to: Math.pow(1024, 5), unit: 'Tio', long: 'tebioctets' }, - { from: Math.pow(1024, 5), to: Math.pow(1024, 6), unit: 'Pio', long: 'pebioctets' }, - { from: Math.pow(1024, 6), to: Math.pow(1024, 7), unit: 'Eio', long: 'exbioctets' }, - { from: Math.pow(1024, 7), to: Math.pow(1024, 8), unit: 'Zio', long: 'zebioctets' }, - { from: Math.pow(1024, 8), to: Math.pow(1024, 9), unit: 'Yio', long: 'yobioctets' }, - ], - }; - Object.assign(tables, options.customUnits); - - const prefix = bytes < 0 ? '-' : ''; - bytes = Math.abs(bytes); - const table = tables[options.units]; - if (table) { - const units = table.find(u => bytes >= u.from && bytes < u.to); - if (units) { - const value = units.from === 0 - ? prefix + bytes - : prefix + (bytes / units.from).toFixed(options.precision); - this.value = value; - this.unit = units.unit; - this.long = units.long; - } else { - this.value = prefix + bytes; - this.unit = ''; - this.long = ''; - } - } else { - throw new Error(`Invalid units specified: ${options.units}`) - } - } - - toString () { - const options = _options.get(this); - return options.toStringFn ? options.toStringFn.bind(this)() : `${this.value} ${this.unit}` - } - } - - /** - * Returns an object with the spec `{ value: string, unit: string, long: string }`. The returned object defines a `toString` method meaning it can be used in any string context. - * @param {number} - The bytes value to convert. - * @param [options] {object} - Optional config. - * @param [options.precision] {number} - Number of decimal places. Defaults to `1`. - * @param [options.units] {string} - Specify `'metric'`, `'iec'`, `'metric_octet'`, `'iec_octet'` or the name of a property from the custom units table in `options.customUnits`. Defaults to `metric`. - * @param [options.customUnits] {object} - An object containing one or more custom unit lookup tables. - * @param [options.toStringFn] {function} - A `toString` function to override the default. - * @returns {object} - * @alias module:byte-size - */ - function byteSize (bytes, options) { - return new ByteSize(bytes, options) - } - - /** - * Set the default `byteSize` options for the duration of the process. - * @param options {object} - A `byteSize` options object. - */ - byteSize.defaultOptions = function (options) { - defaultOptions = options; - }; - - return byteSize; - -}))); diff --git a/node_modules/byte-size/index.mjs b/node_modules/byte-size/index.mjs deleted file mode 100644 index bd6548c68..000000000 --- a/node_modules/byte-size/index.mjs +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @module byte-size - */ - -let defaultOptions = {} -const _options = new WeakMap() - -class ByteSize { - constructor (bytes, options) { - options = Object.assign({ - units: 'metric', - precision: 1 - }, defaultOptions, options) - _options.set(this, options) - - const tables = { - metric: [ - { from: 0 , to: 1e3 , unit: 'B' , long: 'bytes' }, - { from: 1e3 , to: 1e6 , unit: 'kB', long: 'kilobytes' }, - { from: 1e6 , to: 1e9 , unit: 'MB', long: 'megabytes' }, - { from: 1e9 , to: 1e12, unit: 'GB', long: 'gigabytes' }, - { from: 1e12, to: 1e15, unit: 'TB', long: 'terabytes' }, - { from: 1e15, to: 1e18, unit: 'PB', long: 'petabytes' }, - { from: 1e18, to: 1e21, unit: 'EB', long: 'exabytes' }, - { from: 1e21, to: 1e24, unit: 'ZB', long: 'zettabytes' }, - { from: 1e24, to: 1e27, unit: 'YB', long: 'yottabytes' }, - ], - metric_octet: [ - { from: 0 , to: 1e3 , unit: 'o' , long: 'octets' }, - { from: 1e3 , to: 1e6 , unit: 'ko', long: 'kilooctets' }, - { from: 1e6 , to: 1e9 , unit: 'Mo', long: 'megaoctets' }, - { from: 1e9 , to: 1e12, unit: 'Go', long: 'gigaoctets' }, - { from: 1e12, to: 1e15, unit: 'To', long: 'teraoctets' }, - { from: 1e15, to: 1e18, unit: 'Po', long: 'petaoctets' }, - { from: 1e18, to: 1e21, unit: 'Eo', long: 'exaoctets' }, - { from: 1e21, to: 1e24, unit: 'Zo', long: 'zettaoctets' }, - { from: 1e24, to: 1e27, unit: 'Yo', long: 'yottaoctets' }, - ], - iec: [ - { from: 0 , to: Math.pow(1024, 1), unit: 'B' , long: 'bytes' }, - { from: Math.pow(1024, 1), to: Math.pow(1024, 2), unit: 'KiB', long: 'kibibytes' }, - { from: Math.pow(1024, 2), to: Math.pow(1024, 3), unit: 'MiB', long: 'mebibytes' }, - { from: Math.pow(1024, 3), to: Math.pow(1024, 4), unit: 'GiB', long: 'gibibytes' }, - { from: Math.pow(1024, 4), to: Math.pow(1024, 5), unit: 'TiB', long: 'tebibytes' }, - { from: Math.pow(1024, 5), to: Math.pow(1024, 6), unit: 'PiB', long: 'pebibytes' }, - { from: Math.pow(1024, 6), to: Math.pow(1024, 7), unit: 'EiB', long: 'exbibytes' }, - { from: Math.pow(1024, 7), to: Math.pow(1024, 8), unit: 'ZiB', long: 'zebibytes' }, - { from: Math.pow(1024, 8), to: Math.pow(1024, 9), unit: 'YiB', long: 'yobibytes' }, - ], - iec_octet: [ - { from: 0 , to: Math.pow(1024, 1), unit: 'o' , long: 'octets' }, - { from: Math.pow(1024, 1), to: Math.pow(1024, 2), unit: 'Kio', long: 'kibioctets' }, - { from: Math.pow(1024, 2), to: Math.pow(1024, 3), unit: 'Mio', long: 'mebioctets' }, - { from: Math.pow(1024, 3), to: Math.pow(1024, 4), unit: 'Gio', long: 'gibioctets' }, - { from: Math.pow(1024, 4), to: Math.pow(1024, 5), unit: 'Tio', long: 'tebioctets' }, - { from: Math.pow(1024, 5), to: Math.pow(1024, 6), unit: 'Pio', long: 'pebioctets' }, - { from: Math.pow(1024, 6), to: Math.pow(1024, 7), unit: 'Eio', long: 'exbioctets' }, - { from: Math.pow(1024, 7), to: Math.pow(1024, 8), unit: 'Zio', long: 'zebioctets' }, - { from: Math.pow(1024, 8), to: Math.pow(1024, 9), unit: 'Yio', long: 'yobioctets' }, - ], - } - Object.assign(tables, options.customUnits) - - const prefix = bytes < 0 ? '-' : '' - bytes = Math.abs(bytes) - const table = tables[options.units] - if (table) { - const units = table.find(u => bytes >= u.from && bytes < u.to) - if (units) { - const value = units.from === 0 - ? prefix + bytes - : prefix + (bytes / units.from).toFixed(options.precision) - this.value = value - this.unit = units.unit - this.long = units.long - } else { - this.value = prefix + bytes - this.unit = '' - this.long = '' - } - } else { - throw new Error(`Invalid units specified: ${options.units}`) - } - } - - toString () { - const options = _options.get(this) - return options.toStringFn ? options.toStringFn.bind(this)() : `${this.value} ${this.unit}` - } -} - -/** - * Returns an object with the spec `{ value: string, unit: string, long: string }`. The returned object defines a `toString` method meaning it can be used in any string context. - * @param {number} - The bytes value to convert. - * @param [options] {object} - Optional config. - * @param [options.precision] {number} - Number of decimal places. Defaults to `1`. - * @param [options.units] {string} - Specify `'metric'`, `'iec'`, `'metric_octet'`, `'iec_octet'` or the name of a property from the custom units table in `options.customUnits`. Defaults to `metric`. - * @param [options.customUnits] {object} - An object containing one or more custom unit lookup tables. - * @param [options.toStringFn] {function} - A `toString` function to override the default. - * @returns {object} - * @alias module:byte-size - */ -function byteSize (bytes, options) { - return new ByteSize(bytes, options) -} - -/** - * Set the default `byteSize` options for the duration of the process. - * @param options {object} - A `byteSize` options object. - */ -byteSize.defaultOptions = function (options) { - defaultOptions = options -} - -export default byteSize diff --git a/node_modules/byte-size/package.json b/node_modules/byte-size/package.json deleted file mode 100644 index b5f454592..000000000 --- a/node_modules/byte-size/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "byte-size", - "author": "Lloyd Brookes <75pound@gmail.com>", - "contributors": [ - { - "name": "Raul Perez", - "email": "repejota@gmail.com", - "url": "http://repejota.com" - } - ], - "version": "7.0.1", - "main": "dist/index.js", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "description": "Convert a bytes or octets value (e.g. 34565346) to a human-readable string ('34.6 MB'). Choose between metric or IEC units.", - "repository": "https://github.com/75lb/byte-size", - "files": [ - "index.mjs", - "dist/index.js" - ], - "keywords": [ - "convert", - "bytes", - "octet", - "size", - "human", - "readable", - "metric", - "IEC" - ], - "scripts": { - "test": "npm run dist && npm run test:esm && npm run test:web", - "test:esm": "esm-runner test.mjs", - "test:web": "web-runner test.mjs", - "docs": "jsdoc2md -t README.hbs dist/index.js > README.md", - "cover": "c8 npm test && c8 report --reporter=text-lcov | coveralls", - "dist": "rollup -f umd -n byteSize -o dist/index.js index.mjs" - }, - "devDependencies": { - "@test-runner/web": "^0.3.5", - "coveralls": "^3.1.0", - "esm-runner": "^0.3.4", - "isomorphic-assert": "^0.1.1", - "jsdoc-to-markdown": "^7.0.0", - "rollup": "^2.40.0", - "test-object-model": "^0.6.1" - }, - "standard": { - "ignore": [ - "dist" - ] - } -} |