From 8097f8d6e5efd65741057dfcd6ed67b3318b8da3 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Tue, 23 Jan 2018 01:38:06 -0800 Subject: [PATCH] Use lodash.throttle instead of lodash/throttle to prevent requiring the whole lodash lib Reviewed By: jeanlauliac Differential Revision: D6774508 fbshipit-source-id: bc06adda862a3ac2eb4499d941a99a03a5928952 --- packages/metro-core/package.json | 3 ++- packages/metro-core/src/Terminal/Terminal.js | 2 +- packages/metro/package.json | 1 + packages/metro/src/lib/TerminalReporter.js | 2 +- yarn.lock | 4 ++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/metro-core/package.json b/packages/metro-core/package.json index 38eed282..7b4023e7 100644 --- a/packages/metro-core/package.json +++ b/packages/metro-core/package.json @@ -12,6 +12,7 @@ "cleanup-release": "test ! -e build && mv src build && mv src.real src" }, "dependencies": { - "lodash": "^4.16.6" + "lodash": "^4.16.6", + "lodash.throttle": "^4.1.1" } } diff --git a/packages/metro-core/src/Terminal/Terminal.js b/packages/metro-core/src/Terminal/Terminal.js index 830e4f9f..51a11222 100644 --- a/packages/metro-core/src/Terminal/Terminal.js +++ b/packages/metro-core/src/Terminal/Terminal.js @@ -13,7 +13,7 @@ 'use strict'; const readline = require('readline'); -const throttle = require('lodash/throttle'); +const throttle = require('lodash.throttle'); const tty = require('tty'); const util = require('util'); diff --git a/packages/metro/package.json b/packages/metro/package.json index 93cce1cb..2392931b 100644 --- a/packages/metro/package.json +++ b/packages/metro/package.json @@ -41,6 +41,7 @@ "json5": "^0.4.0", "left-pad": "^1.1.3", "lodash": "^4.16.6", + "lodash.throttle": "^4.1.1", "merge-stream": "^1.0.1", "metro-core": "0.24.6", "metro-source-map": "0.24.6", diff --git a/packages/metro/src/lib/TerminalReporter.js b/packages/metro/src/lib/TerminalReporter.js index 361550be..5a93b19e 100644 --- a/packages/metro/src/lib/TerminalReporter.js +++ b/packages/metro/src/lib/TerminalReporter.js @@ -15,7 +15,7 @@ const chalk = require('chalk'); const path = require('path'); const reporting = require('./reporting'); -const throttle = require('lodash/throttle'); +const throttle = require('lodash.throttle'); const { AmbiguousModuleResolutionError, diff --git a/yarn.lock b/yarn.lock index df453113..3b8ba7a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3517,6 +3517,10 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "~3.0.0" +lodash.throttle@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" + lodash@^4.0.0, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.6, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"