From a1bdbea974ebfc6694b4c8ad5da86215c2924dde Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 22 Jul 2021 07:49:40 -0700 Subject: [PATCH] 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 --- lib/utils/format-bytes.js | 22 +++++ lib/utils/tar.js | 10 +- lib/view.js | 6 +- node_modules/byte-size/LICENSE | 21 ---- node_modules/byte-size/dist/index.js | 123 ------------------------ node_modules/byte-size/index.mjs | 115 ---------------------- node_modules/byte-size/package.json | 55 ----------- package-lock.json | 16 --- package.json | 2 - tap-snapshots/test/lib/view.js.test.cjs | 26 ++--- test/lib/utils/tar.js | 4 + 11 files changed, 47 insertions(+), 353 deletions(-) create mode 100644 lib/utils/format-bytes.js delete mode 100644 node_modules/byte-size/LICENSE delete mode 100644 node_modules/byte-size/dist/index.js delete mode 100644 node_modules/byte-size/index.mjs delete mode 100644 node_modules/byte-size/package.json diff --git a/lib/utils/format-bytes.js b/lib/utils/format-bytes.js new file mode 100644 index 0000000000000..87fb561aabef1 --- /dev/null +++ b/lib/utils/format-bytes.js @@ -0,0 +1,22 @@ +// Convert bytes to printable output, for file reporting in tarballs +// Only supports up to GB because that's way larger than anything the registry +// supports anyways. + +const formatBytes = (bytes, space = true) => { + let spacer = '' + if (space) + spacer = ' ' + + if (bytes < 1000) // B + return `${bytes}${spacer}B` + + if (bytes < 1000000) // kB + return `${(bytes / 1000).toFixed(1)}${spacer}kB` + + if (bytes < 1000000000) // MB + return `${(bytes / 1000000).toFixed(1)}${spacer}MB` + + return `${(bytes / 1000000000).toFixed(1)}${spacer}GB` +} + +module.exports = formatBytes diff --git a/lib/utils/tar.js b/lib/utils/tar.js index 9e7c3329530ee..c3071c1bd47a5 100644 --- a/lib/utils/tar.js +++ b/lib/utils/tar.js @@ -1,7 +1,7 @@ const tar = require('tar') const ssri = require('ssri') const npmlog = require('npmlog') -const byteSize = require('byte-size') +const formatBytes = require('./format-bytes.js') const columnify = require('columnify') const logTar = (tarball, opts = {}) => { @@ -11,9 +11,9 @@ const logTar = (tarball, opts = {}) => { log.notice('=== Tarball Contents ===') if (tarball.files.length) { log.notice('', columnify(tarball.files.map((f) => { - const bytes = byteSize(f.size) + const bytes = formatBytes(f.size, false) return (/^node_modules\//.test(f.path)) ? null - : { path: f.path, size: `${bytes.value}${bytes.unit}` } + : { path: f.path, size: `${bytes}` } }).filter(f => f), { include: ['size', 'path'], showHeaders: false, @@ -28,8 +28,8 @@ const logTar = (tarball, opts = {}) => { { name: 'name:', value: tarball.name }, { name: 'version:', value: tarball.version }, tarball.filename && { name: 'filename:', value: tarball.filename }, - { name: 'package size:', value: byteSize(tarball.size) }, - { name: 'unpacked size:', value: byteSize(tarball.unpackedSize) }, + { name: 'package size:', value: formatBytes(tarball.size) }, + { name: 'unpacked size:', value: formatBytes(tarball.unpackedSize) }, { name: 'shasum:', value: tarball.shasum }, { name: 'integrity:', diff --git a/lib/view.js b/lib/view.js index 47e631f5565c0..f4fc5974eeeca 100644 --- a/lib/view.js +++ b/lib/view.js @@ -1,6 +1,5 @@ // npm view [pkg [pkg ...]] -const byteSize = require('byte-size') const color = require('ansicolors') const columns = require('cli-columns') const fs = require('fs') @@ -8,6 +7,7 @@ const jsonParse = require('json-parse-even-better-errors') const log = require('npmlog') const npa = require('npm-package-arg') const { resolve } = require('path') +const formatBytes = require('./utils/format-bytes.js') const relativeDate = require('tiny-relative-date') const semver = require('semver') const style = require('ansistyles') @@ -315,7 +315,7 @@ class View extends BaseCommand { tags.push(`${style.bright(color.green(t))}: ${version}`) }) const unpackedSize = manifest.dist.unpackedSize && - byteSize(manifest.dist.unpackedSize) + formatBytes(manifest.dist.unpackedSize, true) const licenseField = manifest.license || 'Proprietary' const info = { name: color.green(manifest.name), @@ -356,7 +356,7 @@ class View extends BaseCommand { manifest.dist.integrity && color.yellow(manifest.dist.integrity), fileCount: manifest.dist.fileCount && color.yellow(manifest.dist.fileCount), - unpackedSize: unpackedSize && color.yellow(unpackedSize.value) + ' ' + unpackedSize.unit, + unpackedSize: unpackedSize && color.yellow(unpackedSize), } if (info.license.toLowerCase().trim() === 'proprietary') info.license = style.bright(color.red(info.license)) diff --git a/node_modules/byte-size/LICENSE b/node_modules/byte-size/LICENSE deleted file mode 100644 index 5699dfbe51830..0000000000000 --- 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 dd1debda59abd..0000000000000 --- 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 bd6548c686aa5..0000000000000 --- 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 b5f454592da10..0000000000000 --- 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" - ] - } -} diff --git a/package-lock.json b/package-lock.json index 17f4439eee6a7..9288f9a98bfe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,6 @@ "ansicolors", "ansistyles", "archy", - "byte-size", "cacache", "chalk", "chownr", @@ -92,7 +91,6 @@ "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", "archy": "~1.0.0", - "byte-size": "^7.0.1", "cacache": "^15.2.0", "chalk": "^4.1.2", "chownr": "^2.0.0", @@ -1528,15 +1526,6 @@ "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", "inBundle": true }, - "node_modules/byte-size": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/byte-size/-/byte-size-7.0.1.tgz", - "integrity": "sha512-crQdqyCwhokxwV1UyDzLZanhkugAgft7vt0qbbdt60C6Zf3CAiGmtUCylbtYwrU6loOUw3euGrNtW1J651ot1A==", - "inBundle": true, - "engines": { - "node": ">=10" - } - }, "node_modules/cacache": { "version": "15.2.0", "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.2.0.tgz", @@ -11593,11 +11582,6 @@ "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=" }, - "byte-size": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/byte-size/-/byte-size-7.0.1.tgz", - "integrity": "sha512-crQdqyCwhokxwV1UyDzLZanhkugAgft7vt0qbbdt60C6Zf3CAiGmtUCylbtYwrU6loOUw3euGrNtW1J651ot1A==" - }, "cacache": { "version": "15.2.0", "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.2.0.tgz", diff --git a/package.json b/package.json index 635a275826830..8ae29c538427f 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ "ansicolors": "~0.3.2", "ansistyles": "~0.1.3", "archy": "~1.0.0", - "byte-size": "^7.0.1", "cacache": "^15.2.0", "chalk": "^4.1.2", "chownr": "^2.0.0", @@ -132,7 +131,6 @@ "ansicolors", "ansistyles", "archy", - "byte-size", "cacache", "chalk", "chownr", diff --git a/tap-snapshots/test/lib/view.js.test.cjs b/tap-snapshots/test/lib/view.js.test.cjs index 41d7a80fe3b16..27ba7b1eb6927 100644 --- a/tap-snapshots/test/lib/view.js.test.cjs +++ b/tap-snapshots/test/lib/view.js.test.cjs @@ -77,7 +77,7 @@ dist .tarball:http://hm.blue.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -94,7 +94,7 @@ dist .tarball:http://hm.blue.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -118,7 +118,7 @@ dist .tarball:http://hm.green.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dependencies: red: 1.0.0 @@ -178,7 +178,7 @@ dist .tarball:http://hm.orange.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -200,7 +200,7 @@ dist .tarball:http://hm.green.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dependencies: red: 1.0.0 @@ -223,7 +223,7 @@ dist .tarball:http://hm.pink.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -238,7 +238,7 @@ dist .tarball:http://hm.black.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dependencies: 0: 1.0.0 @@ -280,7 +280,7 @@ dist .tarball:http://hm.cyan.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -297,7 +297,7 @@ dist .tarball:http://hm.blue.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -401,7 +401,7 @@ dist .tarball:http://hm.green.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dependencies: red: 1.0.0 @@ -421,7 +421,7 @@ dist .tarball:http://hm.orange.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 @@ -469,7 +469,7 @@ dist .tarball:http://hm.green.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dependencies: red: 1.0.0 @@ -496,7 +496,7 @@ dist .tarball:http://hm.pink.com/1.0.0.tgz .shasum:123 .integrity:--- -.unpackedSize:1 B +.unpackedSize:1 B dist-tags: latest: 1.0.0 diff --git a/test/lib/utils/tar.js b/test/lib/utils/tar.js index 2662d47ace486..19d94916945db 100644 --- a/test/lib/utils/tar.js +++ b/test/lib/utils/tar.js @@ -57,6 +57,8 @@ t.test('should log tarball contents with unicode', async (t) => { logTar({ files: [], bundled: [], + size: 0, + unpackedSize: 0, integrity: '', }, { unicode: true }) t.end() @@ -75,6 +77,8 @@ t.test('should default to npmlog', async (t) => { logTar({ files: [], bundled: [], + size: 0, + unpackedSize: 0, integrity: '', }) t.end()