switch to full lodash library

Individual packages are going away in v5, and we can rely on tree
shaking to only get what we need.
This commit is contained in:
Damien Elmes 2021-04-16 20:07:49 +10:00
parent 7165d06bf2
commit 03f3dfa3d9
5 changed files with 14 additions and 42 deletions

View file

@ -50,8 +50,7 @@ ts_library(
"@npm//@types/d3",
"@npm//@types/lodash",
"@npm//d3",
"@npm//lodash.debounce",
"@npm//lodash.throttle",
"@npm//lodash-es",
"@npm//svelte",
],
)

View file

@ -1,7 +1,7 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import throttle from "lodash.throttle";
import { throttle, DebouncedFunc } from "lodash-es";
import Tooltip from "./Tooltip.svelte";
let tooltip: Tooltip | null = null;
@ -24,7 +24,9 @@ function showTooltipInner(msg: string, x: number, y: number): void {
tooltip.$set({ html: msg, x, y, show: true });
}
export const showTooltip = throttle(showTooltipInner, 16);
export const showTooltip: DebouncedFunc<
(msg: string, x: number, y: number) => void
> = throttle(showTooltipInner, 16);
export function hideTooltip(): void {
const tooltip = getOrCreateTooltip();

View file

@ -439,23 +439,13 @@
"path": "node_modules/jquery",
"licenseFile": "node_modules/jquery/LICENSE.txt"
},
"lodash.debounce@4.0.8": {
"lodash-es@4.17.21": {
"licenses": "MIT",
"repository": "https://github.com/lodash/lodash",
"publisher": "John-David Dalton",
"email": "john.david.dalton@gmail.com",
"url": "http://allyoucanleet.com/",
"path": "node_modules/lodash.debounce",
"licenseFile": "node_modules/lodash.debounce/LICENSE"
},
"lodash.throttle@4.1.1": {
"licenses": "MIT",
"repository": "https://github.com/lodash/lodash",
"publisher": "John-David Dalton",
"email": "john.david.dalton@gmail.com",
"url": "http://allyoucanleet.com/",
"path": "node_modules/lodash.throttle",
"licenseFile": "node_modules/lodash.throttle/LICENSE"
"path": "node_modules/lodash-es",
"licenseFile": "node_modules/lodash-es/LICENSE"
},
"long@4.0.0": {
"licenses": "Apache-2.0",

View file

@ -18,7 +18,6 @@
"@types/jquery": "^3.5.0",
"@types/jqueryui": "^1.12.13",
"@types/lodash": "^4.14.162",
"@types/lodash.throttle": "^4.1.6",
"@types/long": "^4.0.1",
"@types/node": "^14.14.20",
"@types/react": "^16.9.53",
@ -64,8 +63,7 @@
"intl-pluralrules": "^1.2.2",
"jquery": "^3.5.1",
"jquery-ui-dist": "^1.12.1",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"lodash-es": "^4.17.21",
"mathjax": "^3.1.2",
"protobufjs": "^6.10.2"
},

View file

@ -503,11 +503,6 @@
"@types/yargs" "^15.0.0"
chalk "^4.0.0"
"@mdi/svg@^5.9.55":
version "5.9.55"
resolved "https://registry.yarnpkg.com/@mdi/svg/-/svg-5.9.55.tgz#7cba058135afd5d8a3da977f51b71ffc6a3a3699"
integrity sha512-gO0ZpKIeCn9vFg46QduK9MM+n1fuCNwSdcdlBTtbafnnuvwLveK2uj+byhdLtg/8VJGXDhp+DJ35QUMbeWeULA==
"@jest/types@^27.0.0-next.8":
version "27.0.0-next.8"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.0.0-next.8.tgz#bbc9f2acad3fea3e71444bfe06af522044a38951"
@ -940,14 +935,7 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad"
integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==
"@types/lodash.throttle@^4.1.6":
version "4.1.6"
resolved "https://registry.yarnpkg.com/@types/lodash.throttle/-/lodash.throttle-4.1.6.tgz#f5ba2c22244ee42ff6c2c49e614401a870c1009c"
integrity sha512-/UIH96i/sIRYGC60NoY72jGkCJtFN5KVPhEMMMTjol65effe1gPn0tycJqV5tlSwMTzX8FqzB5yAj0rfGHTPNg==
dependencies:
"@types/lodash" "*"
"@types/lodash@*", "@types/lodash@^4.14.162":
"@types/lodash@^4.14.162":
version "4.14.168"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==
@ -3206,15 +3194,10 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.7.0:
version "4.17.21"