From 2544b7125160d8e066284ca3e779c018294e0cb2 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 5 Apr 2018 17:57:36 -0700 Subject: [PATCH] use lodash-es for slightly smaller bundle size --- bin/mastodon-data.js | 2 +- package-lock.json | 53 ++++++++++--------- package.json | 3 +- routes/_actions/addStatusOrNotification.js | 6 +-- routes/_actions/deleteStatuses.js | 4 +- routes/_actions/timeline.js | 2 +- routes/_api/TimelineStream.js | 2 +- .../compose/ComposeContentWarning.html | 2 +- routes/_components/compose/ComposeInput.html | 2 +- .../_components/status/StatusComposeBox.html | 4 +- routes/_components/timeline/Timeline.html | 2 +- .../_components/virtualList/VirtualList.html | 4 +- .../virtualList/VirtualListContainer.html | 2 +- routes/_database/cleanup.js | 2 +- routes/_database/databaseLifecycle.js | 2 +- routes/_database/timelines.js | 4 +- routes/_store/mixins/timelineMixins.js | 2 +- routes/_store/observers/onlineObservers.js | 2 +- routes/_utils/autosize.js | 4 +- routes/_utils/reselect.js | 2 +- routes/_utils/resize.js | 2 +- routes/_utils/sorting.js | 2 +- 22 files changed, 58 insertions(+), 52 deletions(-) diff --git a/bin/mastodon-data.js b/bin/mastodon-data.js index d1bd2a83..ea75c86a 100644 --- a/bin/mastodon-data.js +++ b/bin/mastodon-data.js @@ -1,4 +1,4 @@ -import times from 'lodash/times' +import times from 'lodash-es/times' function unrollThread (user, prefix, privacy, thread) { let res = [] diff --git a/package-lock.json b/package-lock.json index 3936db96..a7551009 100644 --- a/package-lock.json +++ b/package-lock.json @@ -329,7 +329,7 @@ "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "requires": { - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "async-each": { @@ -415,7 +415,7 @@ "convert-source-map": "1.5.1", "debug": "2.6.9", "json5": "0.5.1", - "lodash": "4.17.4", + "lodash": "4.17.5", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", "private": "0.1.8", @@ -434,7 +434,7 @@ "babel-types": "6.26.0", "detect-indent": "4.0.0", "jsesc": "1.3.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "source-map": "0.5.7", "trim-right": "1.0.1" }, @@ -490,7 +490,7 @@ "babel-helper-function-name": "6.24.1", "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-helper-explode-assignable-expression": { @@ -567,7 +567,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-helper-remap-async-to-generator": { @@ -754,7 +754,7 @@ "babel-template": "6.26.0", "babel-traverse": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-plugin-transform-es2015-classes": { @@ -1126,7 +1126,7 @@ "babel-runtime": "6.26.0", "core-js": "2.5.3", "home-or-tmp": "2.0.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "mkdirp": "0.5.1", "source-map-support": "0.4.18" } @@ -1151,7 +1151,7 @@ "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-traverse": { @@ -1168,7 +1168,7 @@ "debug": "2.6.9", "globals": "9.18.0", "invariant": "2.2.3", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-types": { @@ -1179,7 +1179,7 @@ "requires": { "babel-runtime": "6.26.0", "esutils": "2.0.2", - "lodash": "4.17.4", + "lodash": "4.17.5", "to-fast-properties": "1.0.3" } }, @@ -1550,7 +1550,7 @@ "chalk": "1.1.3", "error-stack-parser": "1.3.6", "highlight-es": "1.0.1", - "lodash": "4.17.4", + "lodash": "4.17.5", "pinkie-promise": "2.0.1" } }, @@ -1660,7 +1660,7 @@ "dom-serializer": "0.1.0", "entities": "1.1.1", "htmlparser2": "3.9.2", - "lodash": "4.17.4", + "lodash": "4.17.5", "parse5": "3.0.3" } }, @@ -2925,7 +2925,7 @@ "js-yaml": "3.10.0", "json-stable-stringify": "1.0.1", "levn": "0.3.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "mkdirp": "0.5.1", "natural-compare": "1.4.0", "optionator": "0.8.2", @@ -4748,7 +4748,7 @@ "integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=", "requires": { "glob": "7.1.2", - "lodash": "4.17.4", + "lodash": "4.17.5", "minimatch": "3.0.4" } }, @@ -5126,7 +5126,7 @@ "cli-cursor": "1.0.2", "cli-width": "2.2.0", "figures": "1.7.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "readline2": "1.0.1", "run-async": "0.1.0", "rx-lite": "3.1.2", @@ -5668,16 +5668,21 @@ } }, "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + }, + "lodash-es": { + "version": "4.17.8", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.8.tgz", + "integrity": "sha512-I9mjAxengFAleSThFhhAhvba6fsO0hunb9/0sQ6qQihSZsJRBofv2rYH58WXaOb/O++eUmYpCLywSQ22GfU+sA==" }, "lodash-webpack-plugin": { "version": "0.11.4", "resolved": "https://registry.npmjs.org/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.4.tgz", "integrity": "sha1-bD7Lo9S40ktTlAtjVCcVxe08SsU=", "requires": { - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "lodash._basecallback": { @@ -8638,7 +8643,7 @@ "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", "requires": { "glob": "7.1.2", - "lodash": "4.17.4", + "lodash": "4.17.5", "scss-tokenizer": "0.2.3", "yargs": "7.1.0" }, @@ -9585,7 +9590,7 @@ "ajv": "4.11.8", "ajv-keywords": "1.5.1", "chalk": "1.1.3", - "lodash": "4.17.4", + "lodash": "4.17.5", "slice-ansi": "0.0.4", "string-width": "2.1.1" }, @@ -9663,7 +9668,7 @@ "indent-string": "1.2.2", "is-ci": "1.1.0", "is-glob": "2.0.1", - "lodash": "4.17.4", + "lodash": "4.17.5", "log-update-async-hook": "2.0.2", "map-reverse": "1.0.1", "mkdirp": "0.5.1", @@ -9953,7 +9958,7 @@ "babel-runtime": "5.8.38", "dedent": "0.6.0", "highlight-es": "1.0.1", - "lodash": "4.17.4", + "lodash": "4.17.5", "moment": "2.21.0", "mustache": "2.3.0", "os-family": "1.0.0", @@ -10990,7 +10995,7 @@ "express": "4.16.2", "filesize": "3.6.0", "gzip-size": "4.1.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "mkdirp": "0.5.1", "opener": "1.4.3", "ws": "4.1.0" diff --git a/package.json b/package.json index d86e7fa2..3eeb5c1a 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "idb-keyval": "^2.3.0", "indexeddb-getall-shim": "^1.3.1", "intersection-observer": "^0.5.0", - "lodash": "^4.17.4", + "lodash": "^4.17.5", + "lodash-es": "^4.17.8", "lodash-webpack-plugin": "^0.11.4", "mkdirp": "^0.5.1", "node-fetch": "^1.7.3", diff --git a/routes/_actions/addStatusOrNotification.js b/routes/_actions/addStatusOrNotification.js index c5df4557..8c388196 100644 --- a/routes/_actions/addStatusOrNotification.js +++ b/routes/_actions/addStatusOrNotification.js @@ -1,10 +1,10 @@ -import throttle from 'lodash/throttle' +import throttle from 'lodash-es/throttle' import { database } from '../_database/database' import { mark, stop } from '../_utils/marks' import { store } from '../_store/store' import { scheduleIdleTask } from '../_utils/scheduleIdleTask' -import uniqBy from 'lodash/uniqBy' -import uniq from 'lodash/uniq' +import uniqBy from 'lodash-es/uniqBy' +import uniq from 'lodash-es/uniq' import { isMobile } from '../_utils/isMobile' const STREAMING_THROTTLE_DELAY = 3000 diff --git a/routes/_actions/deleteStatuses.js b/routes/_actions/deleteStatuses.js index b4617bdf..7655ebf3 100644 --- a/routes/_actions/deleteStatuses.js +++ b/routes/_actions/deleteStatuses.js @@ -2,8 +2,8 @@ import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './ import { store } from '../_store/store' import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { database } from '../_database/database' -import forEach from 'lodash/forEach' -import isEqual from 'lodash/isEqual' +import forEach from 'lodash-es/forEach' +import isEqual from 'lodash-es/isEqual' function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) { let keys = ['timelineItemIds', 'itemIdsToAdd'] diff --git a/routes/_actions/timeline.js b/routes/_actions/timeline.js index 176ef3ab..20e80dc3 100644 --- a/routes/_actions/timeline.js +++ b/routes/_actions/timeline.js @@ -5,7 +5,7 @@ import { toast } from '../_utils/toast' import { mark, stop } from '../_utils/marks' import { mergeArrays } from '../_utils/arrays' import { byItemIds } from '../_utils/sorting' -import isEqual from 'lodash/isEqual' +import isEqual from 'lodash-es/isEqual' const FETCH_LIMIT = 20 diff --git a/routes/_api/TimelineStream.js b/routes/_api/TimelineStream.js index 952f0211..4c6e73df 100644 --- a/routes/_api/TimelineStream.js +++ b/routes/_api/TimelineStream.js @@ -1,5 +1,5 @@ import { paramsString } from '../_utils/ajax' -import noop from 'lodash/noop' +import noop from 'lodash-es/noop' import { importWebSocketClient } from '../_utils/asyncModules' function getStreamName (timeline) { diff --git a/routes/_components/compose/ComposeContentWarning.html b/routes/_components/compose/ComposeContentWarning.html index b552582a..a1b112a6 100644 --- a/routes/_components/compose/ComposeContentWarning.html +++ b/routes/_components/compose/ComposeContentWarning.html @@ -15,7 +15,7 @@