From 4259fc8e58a755d5b19dc363989eaae39945fc2a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 29 Aug 2018 20:20:02 -0400 Subject: [PATCH] update shimport, minor tidy up --- package-lock.json | 6 +++--- package.json | 2 +- src/cli/export.ts | 4 ++-- src/core/create_compilers.ts | 3 +-- src/utils.ts | 5 ----- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index dfbec47..a7e0b36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6299,9 +6299,9 @@ } }, "shimport": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/shimport/-/shimport-0.0.5.tgz", - "integrity": "sha512-m1lX1XMFHTJ2Ix3tTHb1REkyrp0sTMtQ4OeibocI7fOErzQr28wf9DSDy2bEXl9KT54m3CDplxBNLrP6HrEVxA==" + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/shimport/-/shimport-0.0.7.tgz", + "integrity": "sha512-A6aDOxg6fHjmFkc2HL4PUW9Cfb+huHZypApNVxCXoBFz6jO+iAmu2wQeXDjqyho3mF4AMpxZTAC+JbmFpKjwug==" }, "signal-exit": { "version": "3.0.2", diff --git a/package.json b/package.json index 24fee69..9911776 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "html-minifier": "^3.5.16", - "shimport": "^0.0.5", + "shimport": "^0.0.8", "source-map-support": "^0.5.6", "tslib": "^1.9.1" }, diff --git a/src/cli/export.ts b/src/cli/export.ts index 00dd1d5..51a0246 100644 --- a/src/cli/export.ts +++ b/src/cli/export.ts @@ -2,7 +2,7 @@ import { exporter as _exporter } from '../api/export'; import colors from 'kleur'; import pb from 'pretty-bytes'; import { locations } from '../config'; -import { right_pad } from '../utils'; +import { left_pad } from '../utils'; export function exporter(export_dir: string, { basepath = '', @@ -22,7 +22,7 @@ export function exporter(export_dir: string, { emitter.on('file', event => { const size_color = event.size > 150000 ? colors.bold.red : event.size > 50000 ? colors.bold.yellow : colors.bold.gray; - const size_label = size_color(right_pad(pb(event.size), 10)); + const size_label = size_color(left_pad(pb(event.size), 10)); const file_label = event.status === 200 ? event.file diff --git a/src/core/create_compilers.ts b/src/core/create_compilers.ts index 7d97b10..b5ed879 100644 --- a/src/core/create_compilers.ts +++ b/src/core/create_compilers.ts @@ -2,9 +2,8 @@ import * as fs from 'fs'; import * as path from 'path'; import colors from 'kleur'; import pb from 'pretty-bytes'; -import { locations } from '../config'; import relative from 'require-relative'; -import { left_pad, right_pad } from '../utils'; +import { left_pad } from '../utils'; let r: any; let wp: any; diff --git a/src/utils.ts b/src/utils.ts index ea70779..7740a8f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -3,11 +3,6 @@ export function left_pad(str: string, len: number) { return str; } -export function right_pad(str: string, len: number) { - while (str.length < len) str += ' '; - return str; -} - export function repeat(str: string, i: number) { let result = ''; while (i--) result += str;