Browse Source

Migrate all lodash' per-method-packages usage to lodash. (#4274)

Fixes: https://github.com/transloadit/uppy/issues/4272
Co-authored-by: R <r@r.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
LinusMain 1 year ago
parent
commit
38de438864

+ 2 - 3
packages/@uppy/companion/package.json

@@ -50,8 +50,7 @@
     "helmet": "^4.6.0",
     "ipaddr.js": "^2.0.1",
     "jsonwebtoken": "8.5.1",
-    "lodash.merge": "^4.6.2",
-    "lodash.throttle": "^4.1.1",
+    "lodash": "^4.17.21",
     "mime-types": "2.1.35",
     "moment": "^2.29.2",
     "moment-timezone": "^0.5.31",
@@ -75,7 +74,7 @@
     "@types/eslint": "^8.2.0",
     "@types/express-session": "1.17.3",
     "@types/jsonwebtoken": "8.3.7",
-    "@types/lodash.merge": "4.6.6",
+    "@types/lodash": "4.14.191",
     "@types/morgan": "1.7.37",
     "@types/ms": "0.7.31",
     "@types/node": "^18.0.3",

+ 1 - 1
packages/@uppy/companion/src/companion.js

@@ -1,6 +1,6 @@
 const express = require('express')
 const Grant = require('grant').default.express()
-const merge = require('lodash.merge')
+const merge = require('lodash/merge')
 const cookieParser = require('cookie-parser')
 const interceptor = require('express-interceptor')
 const { randomUUID } = require('node:crypto')

+ 1 - 1
packages/@uppy/companion/src/server/Uploader.js

@@ -8,7 +8,7 @@ const { join } = require('node:path')
 const fs = require('node:fs')
 const { promisify } = require('node:util')
 const FormData = require('form-data')
-const throttle = require('lodash.throttle')
+const throttle = require('lodash/throttle')
 
 // TODO move to `require('streams/promises').pipeline` when dropping support for Node.js 14.x.
 const pipeline = promisify(pipelineCb)

+ 1 - 1
packages/@uppy/companion/src/standalone/helper.js

@@ -1,5 +1,5 @@
 const fs = require('node:fs')
-const merge = require('lodash.merge')
+const merge = require('lodash/merge')
 const stripIndent = require('common-tags/lib/stripIndent')
 const crypto = require('node:crypto')
 

+ 1 - 1
packages/@uppy/core/package.json

@@ -24,7 +24,7 @@
     "@transloadit/prettier-bytes": "0.0.9",
     "@uppy/store-default": "workspace:^",
     "@uppy/utils": "workspace:^",
-    "lodash.throttle": "^4.1.1",
+    "lodash": "^4.17.21",
     "mime-match": "^1.0.2",
     "namespace-emitter": "^2.0.1",
     "nanoid": "^4.0.0",

+ 1 - 1
packages/@uppy/core/src/Uppy.js

@@ -4,7 +4,7 @@
 import Translator from '@uppy/utils/lib/Translator'
 import ee from 'namespace-emitter'
 import { nanoid } from 'nanoid/non-secure'
-import throttle from 'lodash.throttle'
+import throttle from 'lodash/throttle.js'
 import DefaultStore from '@uppy/store-default'
 import getFileType from '@uppy/utils/lib/getFileType'
 import getFileNameAndExtension from '@uppy/utils/lib/getFileNameAndExtension'

+ 1 - 1
packages/@uppy/dashboard/package.json

@@ -31,7 +31,7 @@
     "@uppy/utils": "workspace:^",
     "classnames": "^2.2.6",
     "is-shallow-equal": "^1.0.1",
-    "lodash.debounce": "^4.0.8",
+    "lodash": "^4.17.21",
     "memoize-one": "^6.0.0",
     "nanoid": "^4.0.0",
     "preact": "^10.5.13"

+ 1 - 1
packages/@uppy/dashboard/src/utils/createSuperFocus.js

@@ -1,4 +1,4 @@
-import debounce from 'lodash.debounce'
+import debounce from 'lodash/debounce.js'
 import FOCUSABLE_ELEMENTS from '@uppy/utils/lib/FOCUSABLE_ELEMENTS'
 import getActiveOverlayEl from './getActiveOverlayEl.js'
 

+ 1 - 1
packages/@uppy/golden-retriever/package.json

@@ -26,7 +26,7 @@
   "dependencies": {
     "@transloadit/prettier-bytes": "0.0.9",
     "@uppy/utils": "workspace:^",
-    "lodash.throttle": "^4.1.1"
+    "lodash": "^4.17.21"
   },
   "peerDependencies": {
     "@uppy/core": "workspace:^"

+ 1 - 1
packages/@uppy/golden-retriever/src/index.js

@@ -1,4 +1,4 @@
-import throttle from 'lodash.throttle'
+import throttle from 'lodash/throttle.js'
 import BasePlugin from '@uppy/core/lib/BasePlugin.js'
 import ServiceWorkerStore from './ServiceWorkerStore.js'
 import IndexedDBStore from './IndexedDBStore.js'

+ 1 - 1
packages/@uppy/status-bar/package.json

@@ -30,7 +30,7 @@
     "@transloadit/prettier-bytes": "0.0.9",
     "@uppy/utils": "workspace:^",
     "classnames": "^2.2.6",
-    "lodash.throttle": "^4.1.1",
+    "lodash": "^4.17.21",
     "preact": "^10.5.13"
   },
   "peerDependencies": {

+ 1 - 1
packages/@uppy/status-bar/src/Components.jsx

@@ -1,6 +1,6 @@
 import { h } from 'preact'
 import classNames from 'classnames'
-import throttle from 'lodash.throttle'
+import throttle from 'lodash/throttle.js'
 import prettierBytes from '@transloadit/prettier-bytes'
 import prettyETA from '@uppy/utils/lib/prettyETA'
 

+ 1 - 1
packages/@uppy/utils/package.json

@@ -67,7 +67,7 @@
     "./src/microtip.scss": "./src/microtip.scss"
   },
   "dependencies": {
-    "lodash.throttle": "^4.1.1"
+    "lodash": "^4.17.21"
   },
   "devDependencies": {
     "@jest/globals": "^29.0.0"

+ 1 - 1
packages/@uppy/utils/src/emitSocketProgress.js

@@ -1,4 +1,4 @@
-import throttle from 'lodash.throttle'
+import throttle from 'lodash/throttle.js'
 
 function emitSocketProgress (uploader, progressData, file) {
   const { progress, bytesUploaded, bytesTotal } = progressData

+ 12 - 15
yarn.lock

@@ -8001,16 +8001,14 @@ __metadata:
   languageName: node
   linkType: hard
 
-"@types/lodash.merge@npm:4.6.6":
-  version: 4.6.6
-  resolution: "@types/lodash.merge@npm:4.6.6"
-  dependencies:
-    "@types/lodash": "*"
-  checksum: 62ec56f14b3077f7174497856e9b277db811943cd11b1d67d2a8e51a1803bd49319e8aaf62e745c696af972354a575dbb8a85d3aecf4ae774caf062dc31ac46e
+"@types/lodash@npm:4.14.191":
+  version: 4.14.191
+  resolution: "@types/lodash@npm:4.14.191"
+  checksum: ba0d5434e10690869f32d5ea49095250157cae502f10d57de0a723fd72229ce6c6a4979576f0f13e0aa9fbe3ce2457bfb9fa7d4ec3d6daba56730a51906d1491
   languageName: node
   linkType: hard
 
-"@types/lodash@npm:*, @types/lodash@npm:^4.14.167":
+"@types/lodash@npm:^4.14.167":
   version: 4.14.184
   resolution: "@types/lodash@npm:4.14.184"
   checksum: 6d9a4d67f7f9d0ec3fd21174f3dd3d00629dc1227eb469450eace53adbc1f7e2330699c28d0fe093e5f0fef0f0e763098be1f779268857213224af082b62be21
@@ -9302,7 +9300,7 @@ __metadata:
     "@types/eslint": ^8.2.0
     "@types/express-session": 1.17.3
     "@types/jsonwebtoken": 8.3.7
-    "@types/lodash.merge": 4.6.6
+    "@types/lodash": 4.14.191
     "@types/morgan": 1.7.37
     "@types/ms": 0.7.31
     "@types/node": ^18.0.3
@@ -9334,8 +9332,7 @@ __metadata:
     ipaddr.js: ^2.0.1
     jest: ^29.0.0
     jsonwebtoken: 8.5.1
-    lodash.merge: ^4.6.2
-    lodash.throttle: ^4.1.1
+    lodash: ^4.17.21
     mime-types: 2.1.35
     moment: ^2.29.2
     moment-timezone: ^0.5.31
@@ -9380,7 +9377,7 @@ __metadata:
     "@transloadit/prettier-bytes": 0.0.9
     "@uppy/store-default": "workspace:^"
     "@uppy/utils": "workspace:^"
-    lodash.throttle: ^4.1.1
+    lodash: ^4.17.21
     mime-match: ^1.0.2
     namespace-emitter: ^2.0.1
     nanoid: ^4.0.0
@@ -9402,7 +9399,7 @@ __metadata:
     "@uppy/utils": "workspace:^"
     classnames: ^2.2.6
     is-shallow-equal: ^1.0.1
-    lodash.debounce: ^4.0.8
+    lodash: ^4.17.21
     memoize-one: ^6.0.0
     nanoid: ^4.0.0
     preact: ^10.5.13
@@ -9487,7 +9484,7 @@ __metadata:
   dependencies:
     "@transloadit/prettier-bytes": 0.0.9
     "@uppy/utils": "workspace:^"
-    lodash.throttle: ^4.1.1
+    lodash: ^4.17.21
   peerDependencies:
     "@uppy/core": "workspace:^"
   languageName: unknown
@@ -9680,7 +9677,7 @@ __metadata:
     "@transloadit/prettier-bytes": 0.0.9
     "@uppy/utils": "workspace:^"
     classnames: ^2.2.6
-    lodash.throttle: ^4.1.1
+    lodash: ^4.17.21
     preact: ^10.5.13
   peerDependencies:
     "@uppy/core": "workspace:^"
@@ -9800,7 +9797,7 @@ __metadata:
   resolution: "@uppy/utils@workspace:packages/@uppy/utils"
   dependencies:
     "@jest/globals": ^29.0.0
-    lodash.throttle: ^4.1.1
+    lodash: ^4.17.21
   languageName: unknown
   linkType: soft