use lodash-es for slightly smaller bundle size

This commit is contained in:
Nolan Lawson 2018-04-05 17:57:36 -07:00
parent a6d2382f97
commit 2544b71251
22 changed files with 58 additions and 52 deletions

View File

@ -1,4 +1,4 @@
import times from 'lodash/times' import times from 'lodash-es/times'
function unrollThread (user, prefix, privacy, thread) { function unrollThread (user, prefix, privacy, thread) {
let res = [] let res = []

53
package-lock.json generated
View File

@ -329,7 +329,7 @@
"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz",
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
"requires": { "requires": {
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"async-each": { "async-each": {
@ -415,7 +415,7 @@
"convert-source-map": "1.5.1", "convert-source-map": "1.5.1",
"debug": "2.6.9", "debug": "2.6.9",
"json5": "0.5.1", "json5": "0.5.1",
"lodash": "4.17.4", "lodash": "4.17.5",
"minimatch": "3.0.4", "minimatch": "3.0.4",
"path-is-absolute": "1.0.1", "path-is-absolute": "1.0.1",
"private": "0.1.8", "private": "0.1.8",
@ -434,7 +434,7 @@
"babel-types": "6.26.0", "babel-types": "6.26.0",
"detect-indent": "4.0.0", "detect-indent": "4.0.0",
"jsesc": "1.3.0", "jsesc": "1.3.0",
"lodash": "4.17.4", "lodash": "4.17.5",
"source-map": "0.5.7", "source-map": "0.5.7",
"trim-right": "1.0.1" "trim-right": "1.0.1"
}, },
@ -490,7 +490,7 @@
"babel-helper-function-name": "6.24.1", "babel-helper-function-name": "6.24.1",
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"babel-types": "6.26.0", "babel-types": "6.26.0",
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"babel-helper-explode-assignable-expression": { "babel-helper-explode-assignable-expression": {
@ -567,7 +567,7 @@
"requires": { "requires": {
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"babel-types": "6.26.0", "babel-types": "6.26.0",
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"babel-helper-remap-async-to-generator": { "babel-helper-remap-async-to-generator": {
@ -754,7 +754,7 @@
"babel-template": "6.26.0", "babel-template": "6.26.0",
"babel-traverse": "6.26.0", "babel-traverse": "6.26.0",
"babel-types": "6.26.0", "babel-types": "6.26.0",
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"babel-plugin-transform-es2015-classes": { "babel-plugin-transform-es2015-classes": {
@ -1126,7 +1126,7 @@
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"core-js": "2.5.3", "core-js": "2.5.3",
"home-or-tmp": "2.0.0", "home-or-tmp": "2.0.0",
"lodash": "4.17.4", "lodash": "4.17.5",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"source-map-support": "0.4.18" "source-map-support": "0.4.18"
} }
@ -1151,7 +1151,7 @@
"babel-traverse": "6.26.0", "babel-traverse": "6.26.0",
"babel-types": "6.26.0", "babel-types": "6.26.0",
"babylon": "6.18.0", "babylon": "6.18.0",
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"babel-traverse": { "babel-traverse": {
@ -1168,7 +1168,7 @@
"debug": "2.6.9", "debug": "2.6.9",
"globals": "9.18.0", "globals": "9.18.0",
"invariant": "2.2.3", "invariant": "2.2.3",
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"babel-types": { "babel-types": {
@ -1179,7 +1179,7 @@
"requires": { "requires": {
"babel-runtime": "6.26.0", "babel-runtime": "6.26.0",
"esutils": "2.0.2", "esutils": "2.0.2",
"lodash": "4.17.4", "lodash": "4.17.5",
"to-fast-properties": "1.0.3" "to-fast-properties": "1.0.3"
} }
}, },
@ -1550,7 +1550,7 @@
"chalk": "1.1.3", "chalk": "1.1.3",
"error-stack-parser": "1.3.6", "error-stack-parser": "1.3.6",
"highlight-es": "1.0.1", "highlight-es": "1.0.1",
"lodash": "4.17.4", "lodash": "4.17.5",
"pinkie-promise": "2.0.1" "pinkie-promise": "2.0.1"
} }
}, },
@ -1660,7 +1660,7 @@
"dom-serializer": "0.1.0", "dom-serializer": "0.1.0",
"entities": "1.1.1", "entities": "1.1.1",
"htmlparser2": "3.9.2", "htmlparser2": "3.9.2",
"lodash": "4.17.4", "lodash": "4.17.5",
"parse5": "3.0.3" "parse5": "3.0.3"
} }
}, },
@ -2925,7 +2925,7 @@
"js-yaml": "3.10.0", "js-yaml": "3.10.0",
"json-stable-stringify": "1.0.1", "json-stable-stringify": "1.0.1",
"levn": "0.3.0", "levn": "0.3.0",
"lodash": "4.17.4", "lodash": "4.17.5",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"natural-compare": "1.4.0", "natural-compare": "1.4.0",
"optionator": "0.8.2", "optionator": "0.8.2",
@ -4748,7 +4748,7 @@
"integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=", "integrity": "sha1-HcScaCLdnoovoAuiopUAboZkvQk=",
"requires": { "requires": {
"glob": "7.1.2", "glob": "7.1.2",
"lodash": "4.17.4", "lodash": "4.17.5",
"minimatch": "3.0.4" "minimatch": "3.0.4"
} }
}, },
@ -5126,7 +5126,7 @@
"cli-cursor": "1.0.2", "cli-cursor": "1.0.2",
"cli-width": "2.2.0", "cli-width": "2.2.0",
"figures": "1.7.0", "figures": "1.7.0",
"lodash": "4.17.4", "lodash": "4.17.5",
"readline2": "1.0.1", "readline2": "1.0.1",
"run-async": "0.1.0", "run-async": "0.1.0",
"rx-lite": "3.1.2", "rx-lite": "3.1.2",
@ -5668,16 +5668,21 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.4", "version": "4.17.5",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" "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": { "lodash-webpack-plugin": {
"version": "0.11.4", "version": "0.11.4",
"resolved": "https://registry.npmjs.org/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.4.tgz", "resolved": "https://registry.npmjs.org/lodash-webpack-plugin/-/lodash-webpack-plugin-0.11.4.tgz",
"integrity": "sha1-bD7Lo9S40ktTlAtjVCcVxe08SsU=", "integrity": "sha1-bD7Lo9S40ktTlAtjVCcVxe08SsU=",
"requires": { "requires": {
"lodash": "4.17.4" "lodash": "4.17.5"
} }
}, },
"lodash._basecallback": { "lodash._basecallback": {
@ -8638,7 +8643,7 @@
"integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=",
"requires": { "requires": {
"glob": "7.1.2", "glob": "7.1.2",
"lodash": "4.17.4", "lodash": "4.17.5",
"scss-tokenizer": "0.2.3", "scss-tokenizer": "0.2.3",
"yargs": "7.1.0" "yargs": "7.1.0"
}, },
@ -9585,7 +9590,7 @@
"ajv": "4.11.8", "ajv": "4.11.8",
"ajv-keywords": "1.5.1", "ajv-keywords": "1.5.1",
"chalk": "1.1.3", "chalk": "1.1.3",
"lodash": "4.17.4", "lodash": "4.17.5",
"slice-ansi": "0.0.4", "slice-ansi": "0.0.4",
"string-width": "2.1.1" "string-width": "2.1.1"
}, },
@ -9663,7 +9668,7 @@
"indent-string": "1.2.2", "indent-string": "1.2.2",
"is-ci": "1.1.0", "is-ci": "1.1.0",
"is-glob": "2.0.1", "is-glob": "2.0.1",
"lodash": "4.17.4", "lodash": "4.17.5",
"log-update-async-hook": "2.0.2", "log-update-async-hook": "2.0.2",
"map-reverse": "1.0.1", "map-reverse": "1.0.1",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
@ -9953,7 +9958,7 @@
"babel-runtime": "5.8.38", "babel-runtime": "5.8.38",
"dedent": "0.6.0", "dedent": "0.6.0",
"highlight-es": "1.0.1", "highlight-es": "1.0.1",
"lodash": "4.17.4", "lodash": "4.17.5",
"moment": "2.21.0", "moment": "2.21.0",
"mustache": "2.3.0", "mustache": "2.3.0",
"os-family": "1.0.0", "os-family": "1.0.0",
@ -10990,7 +10995,7 @@
"express": "4.16.2", "express": "4.16.2",
"filesize": "3.6.0", "filesize": "3.6.0",
"gzip-size": "4.1.0", "gzip-size": "4.1.0",
"lodash": "4.17.4", "lodash": "4.17.5",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"opener": "1.4.3", "opener": "1.4.3",
"ws": "4.1.0" "ws": "4.1.0"

View File

@ -48,7 +48,8 @@
"idb-keyval": "^2.3.0", "idb-keyval": "^2.3.0",
"indexeddb-getall-shim": "^1.3.1", "indexeddb-getall-shim": "^1.3.1",
"intersection-observer": "^0.5.0", "intersection-observer": "^0.5.0",
"lodash": "^4.17.4", "lodash": "^4.17.5",
"lodash-es": "^4.17.8",
"lodash-webpack-plugin": "^0.11.4", "lodash-webpack-plugin": "^0.11.4",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"node-fetch": "^1.7.3", "node-fetch": "^1.7.3",

View File

@ -1,10 +1,10 @@
import throttle from 'lodash/throttle' import throttle from 'lodash-es/throttle'
import { database } from '../_database/database' import { database } from '../_database/database'
import { mark, stop } from '../_utils/marks' import { mark, stop } from '../_utils/marks'
import { store } from '../_store/store' import { store } from '../_store/store'
import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
import uniqBy from 'lodash/uniqBy' import uniqBy from 'lodash-es/uniqBy'
import uniq from 'lodash/uniq' import uniq from 'lodash-es/uniq'
import { isMobile } from '../_utils/isMobile' import { isMobile } from '../_utils/isMobile'
const STREAMING_THROTTLE_DELAY = 3000 const STREAMING_THROTTLE_DELAY = 3000

View File

@ -2,8 +2,8 @@ import { getIdsThatRebloggedThisStatus, getNotificationIdsForStatuses } from './
import { store } from '../_store/store' import { store } from '../_store/store'
import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../_utils/scheduleIdleTask'
import { database } from '../_database/database' import { database } from '../_database/database'
import forEach from 'lodash/forEach' import forEach from 'lodash-es/forEach'
import isEqual from 'lodash/isEqual' import isEqual from 'lodash-es/isEqual'
function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) { function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) {
let keys = ['timelineItemIds', 'itemIdsToAdd'] let keys = ['timelineItemIds', 'itemIdsToAdd']

View File

@ -5,7 +5,7 @@ import { toast } from '../_utils/toast'
import { mark, stop } from '../_utils/marks' import { mark, stop } from '../_utils/marks'
import { mergeArrays } from '../_utils/arrays' import { mergeArrays } from '../_utils/arrays'
import { byItemIds } from '../_utils/sorting' import { byItemIds } from '../_utils/sorting'
import isEqual from 'lodash/isEqual' import isEqual from 'lodash-es/isEqual'
const FETCH_LIMIT = 20 const FETCH_LIMIT = 20

View File

@ -1,5 +1,5 @@
import { paramsString } from '../_utils/ajax' import { paramsString } from '../_utils/ajax'
import noop from 'lodash/noop' import noop from 'lodash-es/noop'
import { importWebSocketClient } from '../_utils/asyncModules' import { importWebSocketClient } from '../_utils/asyncModules'
function getStreamName (timeline) { function getStreamName (timeline) {

View File

@ -15,7 +15,7 @@
</style> </style>
<script> <script>
import { store } from '../../_store/store' import { store } from '../../_store/store'
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
export default { export default {

View File

@ -30,7 +30,7 @@
import { store } from '../../_store/store' import { store } from '../../_store/store'
import { autosize } from '../../_utils/autosize' import { autosize } from '../../_utils/autosize'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { selectionChange } from '../../_utils/events' import { selectionChange } from '../../_utils/events'
import { clickSelectedAutosuggestionUsername } from '../../_actions/compose' import { clickSelectedAutosuggestionUsername } from '../../_actions/compose'

View File

@ -17,8 +17,8 @@
<script> <script>
import ComposeBox from '../../_components/compose/ComposeBox.html' import ComposeBox from '../../_components/compose/ComposeBox.html'
import { store } from '../../_store/store' import { store } from '../../_store/store'
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
import throttle from 'lodash/throttle' import throttle from 'lodash-es/throttle'
const DEBOUNCE_DELAY = 400 const DEBOUNCE_DELAY = 400
const THROTTLE_DELAY = 150 const THROTTLE_DELAY = 150

View File

@ -61,7 +61,7 @@
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { importPseudoVirtualList } from '../../_utils/asyncModules' import { importPseudoVirtualList } from '../../_utils/asyncModules'
import isEqual from 'lodash/isEqual' import isEqual from 'lodash-es/isEqual'
import { doubleRAF } from '../../_utils/doubleRAF' import { doubleRAF } from '../../_utils/doubleRAF'
export default { export default {

View File

@ -29,9 +29,9 @@
import VirtualListFooter from './VirtualListFooter.html' import VirtualListFooter from './VirtualListFooter.html'
import VirtualListHeader from './VirtualListHeader.html' import VirtualListHeader from './VirtualListHeader.html'
import { virtualListStore } from './virtualListStore' import { virtualListStore } from './virtualListStore'
import throttle from 'lodash/throttle' import throttle from 'lodash-es/throttle'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import isEqual from 'lodash/isEqual' import isEqual from 'lodash-es/isEqual'
const DISTANCE_FROM_BOTTOM_TO_FIRE = 800 const DISTANCE_FROM_BOTTOM_TO_FIRE = 800
const SCROLL_EVENT_THROTTLE = 1000 const SCROLL_EVENT_THROTTLE = 1000

View File

@ -1,7 +1,7 @@
<slot></slot> <slot></slot>
<script> <script>
import { virtualListStore } from './virtualListStore' import { virtualListStore } from './virtualListStore'
import throttle from 'lodash/throttle' import throttle from 'lodash-es/throttle'
import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../../_utils/fullscreen' import { isFullscreen, attachFullscreenListener, detachFullscreenListener } from '../../_utils/fullscreen'
import { mark, stop } from '../../_utils/marks' import { mark, stop } from '../../_utils/marks'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'

View File

@ -11,7 +11,7 @@ import {
THREADS_STORE, THREADS_STORE,
TIMESTAMP TIMESTAMP
} from './constants' } from './constants'
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
import { store } from '../_store/store' import { store } from '../_store/store'
import { mark, stop } from '../_utils/marks' import { mark, stop } from '../_utils/marks'
import { deleteAll } from './utils' import { deleteAll } from './utils'

View File

@ -14,7 +14,7 @@ import {
USERNAME_LOWERCASE USERNAME_LOWERCASE
} from './constants' } from './constants'
import forEach from 'lodash/forEach' import forEach from 'lodash-es/forEach'
const openReqs = {} const openReqs = {}
const databaseCache = {} const databaseCache = {}

View File

@ -1,5 +1,5 @@
import difference from 'lodash/difference' import difference from 'lodash-es/difference'
import times from 'lodash/times' import times from 'lodash-es/times'
import { cloneForStorage } from './helpers' import { cloneForStorage } from './helpers'
import { dbPromise, getDatabase } from './databaseLifecycle' import { dbPromise, getDatabase } from './databaseLifecycle'
import { import {

View File

@ -1,4 +1,4 @@
import pickBy from 'lodash/pickBy' import pickBy from 'lodash-es/pickBy'
export function timelineMixins (Store) { export function timelineMixins (Store) {
Store.prototype.setForTimeline = function (instanceName, timelineName, obj) { Store.prototype.setForTimeline = function (instanceName, timelineName, obj) {

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
import { toast } from '../../_utils/toast' import { toast } from '../../_utils/toast'
const OFFLINE_DELAY = 1000 const OFFLINE_DELAY = 1000

View File

@ -4,8 +4,8 @@
// add deferredUpdate, and add perf marks. // add deferredUpdate, and add perf marks.
import { mark, stop } from './marks' import { mark, stop } from './marks'
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
import throttle from 'lodash/throttle' import throttle from 'lodash-es/throttle'
const map = new Map() const map = new Map()
let createEvent = (name) => new Event(name, {bubbles: true}) let createEvent = (name) => new Event(name, {bubbles: true})

View File

@ -3,7 +3,7 @@
// This avoids the issue where Svelte may keep re-rendering because it doesn't // This avoids the issue where Svelte may keep re-rendering because it doesn't
// know if an object/array has changed or not. // know if an object/array has changed or not.
import isEqual from 'lodash/isEqual' import isEqual from 'lodash-es/isEqual'
if (process.browser && process.env.NODE_ENV !== 'production') { if (process.browser && process.env.NODE_ENV !== 'production') {
window.reselectStats = {} window.reselectStats = {}

View File

@ -1,4 +1,4 @@
import debounce from 'lodash/debounce' import debounce from 'lodash-es/debounce'
const DEBOUNCE_DELAY = 700 const DEBOUNCE_DELAY = 700

View File

@ -1,4 +1,4 @@
import padStart from 'lodash/padStart' import padStart from 'lodash-es/padStart'
export function zeroPad (str, toSize) { export function zeroPad (str, toSize) {
return padStart(str, toSize, '0') return padStart(str, toSize, '0')