Bug 1750514 - [devtools] Remove lodash-move. r=ochameau.

Differential Revision: https://phabricator.services.mozilla.com/D136166
This commit is contained in:
Nicolas Chevobbe 2022-01-20 07:21:09 +00:00
Родитель 49d84414bf
Коммит 95d313e862
7 изменённых файлов: 19 добавлений и 62 удалений

Просмотреть файл

@ -2405,7 +2405,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"1": 1
"0": 0
}
}
}
@ -2426,7 +2426,7 @@
"byName": {},
"byBlocks": {},
"usedIds": {
"1": 1
"0": 0
}
}
}

41
devtools/client/debugger/dist/vendors.js поставляемый
Просмотреть файл

@ -1287,8 +1287,6 @@ var reactAriaComponentsTabs = _interopRequireWildcard(__webpack_require__(937));
var _classnames = _interopRequireDefault(__webpack_require__(943));
var _lodashMove = _interopRequireDefault(__webpack_require__(948));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@ -1319,7 +1317,6 @@ const vendored = {
classnames: _classnames.default,
"devtools-utils": devtoolsUtils,
"fuzzaldrin-plus": fuzzaldrinPlus,
"lodash-move": _lodashMove.default,
"react-aria-components/src/tabs": reactAriaComponentsTabs,
"react-transition-group/Transition": transition
};
@ -2768,44 +2765,6 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
}());
/***/ }),
/***/ 948:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = move;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function move(array, moveIndex, toIndex) {
/* #move - Moves an array item from one position in an array to another.
Note: This is a pure function so a new array will be returned, instead
of altering the array argument.
Arguments:
1. array (String) : Array in which to move an item. (required)
2. moveIndex (Object) : The index of the item to move. (required)
3. toIndex (Object) : The index to move item at moveIndex to. (required)
*/
var item = array[moveIndex];
var length = array.length;
var diff = moveIndex - toIndex;
if (diff > 0) {
// move left
return [].concat(_toConsumableArray(array.slice(0, toIndex)), [item], _toConsumableArray(array.slice(toIndex, moveIndex)), _toConsumableArray(array.slice(moveIndex + 1, length)));
} else if (diff < 0) {
// move right
return [].concat(_toConsumableArray(array.slice(0, moveIndex)), _toConsumableArray(array.slice(moveIndex + 1, toIndex + 1)), [item], _toConsumableArray(array.slice(toIndex + 1, length)));
}
return array;
}
/***/ }),
/***/ 957:

Просмотреть файл

@ -25,7 +25,6 @@
"codemirror": "^5.28.0",
"fuzzaldrin-plus": "^0.6.0",
"lodash": "^4.17.4",
"lodash-move": "^1.1.1",
"parse-script-tags": "github:loganfsmyth/parse-script-tags#d771732ca47e1b3554fe67d609fd18cc785c5f26",
"pretty-fast": "^0.2.7",
"react": "16.8.6",

Просмотреть файл

@ -9,7 +9,6 @@
import { createSelector } from "reselect";
import { isOriginalId } from "devtools-source-map";
import move from "lodash-move";
import { isSimilarTab, persistTabs } from "../utils/tabs";
import { makeShallowQuery } from "../utils/resource";
@ -227,17 +226,27 @@ function updateTabList(
}
function moveTabInList(state, { url, tabIndex: newIndex }) {
let { tabs } = state;
const { tabs } = state;
const currentIndex = tabs.findIndex(tab => tab.url == url);
tabs = move(tabs, currentIndex, newIndex);
return { tabs };
return moveTab(tabs, currentIndex, newIndex);
}
function moveTabInListBySourceId(state, { sourceId, tabIndex: newIndex }) {
let { tabs } = state;
const { tabs } = state;
const currentIndex = tabs.findIndex(tab => tab.sourceId == sourceId);
tabs = move(tabs, currentIndex, newIndex);
return { tabs };
return moveTab(tabs, currentIndex, newIndex);
}
function moveTab(tabs, currentIndex, newIndex) {
const item = tabs[currentIndex];
const newTabs = Array.from(tabs);
// Remove the item from its current location
newTabs.splice(currentIndex, 1);
// And add it to the new one
newTabs.splice(newIndex, 0, item);
return { tabs: newTabs };
}
// Selectors

Просмотреть файл

@ -21,7 +21,6 @@ import * as reactAriaComponentsTabs from "react-aria-components/src/tabs";
// Modules imported without destructuring
import classnames from "classnames";
import move from "lodash-move";
// We cannot directly export literals containing special characters
// (eg. "my-module/Test") which is why they are nested in "vendored".
@ -31,7 +30,6 @@ export const vendored = {
classnames,
"devtools-utils": devtoolsUtils,
"fuzzaldrin-plus": fuzzaldrinPlus,
"lodash-move": move,
"react-aria-components/src/tabs": reactAriaComponentsTabs,
"react-transition-group/Transition": transition,
};

Просмотреть файл

@ -5617,13 +5617,6 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
lodash-move@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/lodash-move/-/lodash-move-1.1.1.tgz#59f76e0f1ac57e6d8683f531bec07c5b6ea4e348"
integrity sha1-WfduDxrFfm2Gg/UxvsB8W26k40g=
dependencies:
lodash "^4.6.1"
lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
@ -5664,7 +5657,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@^4.15.0, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4, lodash@^4.6.1:
lodash@^4.15.0, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.4:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==

Просмотреть файл

@ -45,7 +45,6 @@ const VENDORS = [
"devtools-environment",
"devtools-utils",
"fuzzaldrin-plus",
"lodash-move",
"react-aria-components/src/tabs",
"react-transition-group/Transition",
"Svg",