Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(NA): upgrade to lodash@4 #69868

Merged
merged 60 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
bd13173
chore(NA): upgrade oss to lodash4
mistic Jun 23, 2020
87a2a07
chore(NA): move x-pack and packages to lodash 4
mistic Jun 23, 2020
15dc299
chore(NA): remove mention to lodash from main package.json
mistic Jun 25, 2020
5440b91
chore(NA): remove helper alias for lodash4 and make it the default lo…
mistic Jun 25, 2020
45e3ab8
chore(NA): merge and solve conflicts with master
mistic Jun 25, 2020
e0bdfe8
chore(NA): fix last failing types in the repo
mistic Jun 25, 2020
7ebf381
chore(NA): fix public api
mistic Jun 25, 2020
a1186a1
chore(NA): merge and solve conflicts with master
mistic Jun 25, 2020
2d92668
chore(NA): fix types for agg_row.tsx
mistic Jun 25, 2020
f02be1d
chore(NA): fix increment of optimizer modules in the rollup plugin
mistic Jun 25, 2020
a507200
Merge remote-tracking branch 'upstream/master' into upgrade-lodash-4-…
mistic Jun 25, 2020
3d48011
Merge remote-tracking branch 'upstream/master' into upgrade-lodash-4-…
mistic Jun 25, 2020
aac7d7e
chore(NA): migrate `src/core/public/http/fetch.ts` (#5)
pgayvallet Jun 25, 2020
e036962
chore(NA): fixes for feedback from apm team
mistic Jun 26, 2020
ddf9e30
chore(NA): recover old behaviour on apm LoadingIndeicatorContext.tsx
mistic Jun 26, 2020
bfeeb25
chore(NA): fixes for feedback from watson
mistic Jun 26, 2020
554456d
Platform lodash4 tweaks (#6)
joshdover Jun 26, 2020
f656fad
chore(NA): fix types and behaviour on src/core/server/elasticsearch/e…
mistic Jun 26, 2020
17b1535
Canvas fixes for lodash upgrade
clintandrewhall Jun 26, 2020
2737269
chore(NA): merge and solve conflicts with master
mistic Jun 26, 2020
9a8db48
[APM] Adds unit test for APM service maps transform (#7)
ogupte Jun 28, 2020
afb1c5f
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jun 28, 2020
dc5085b
chore(NA): update yarn.lock
mistic Jun 28, 2020
0f366ab
chore(NA): remove any and use a real type for alerts task runner
mistic Jun 29, 2020
3aad0e1
chore(NA): used named import for triggers_actions_ui file
mistic Jun 29, 2020
a2573fa
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jun 29, 2020
e0a41df
chore(NA): fix eslint
mistic Jun 29, 2020
3325f1b
Merge remote-tracking branch 'upstream/master' into upgrade-lodash-4-…
mistic Jun 29, 2020
369c024
chore(NA): fix types
mistic Jun 29, 2020
95665f0
chore(NA): merge and solve conflicts with master
mistic Jun 29, 2020
8841eef
Delete most uptime lodash references.
justinkambic Jun 29, 2020
3ddbbd9
Simplify. Clean up types.
justinkambic Jun 29, 2020
567f1e4
[Uptime] Delete most uptime lodash references (#8)
justinkambic Jun 29, 2020
57dcad5
chore(NA): add eslint rule to avoid using lodash3
mistic Jun 29, 2020
3f1c6ad
Merge branch 'upgrade-lodash-4-final' of github.com:mistic/kibana int…
mistic Jun 29, 2020
aa47a1f
chore(NA): apply changes on feedback from es-ui team
mistic Jun 29, 2020
7c11a06
fix some types (#9)
stratoula Jun 30, 2020
6b87e55
chore(NA): merge and solve conflicts with master
mistic Jun 30, 2020
90a88df
Clean up some expressions types.
lukeelmers Jun 30, 2020
864755c
chore(NA): missing ts-expect-error statements
mistic Jun 30, 2020
6ea3923
Clean up some expressions types. (#10)
mistic Jun 30, 2020
65dc116
chore(NA): merge and solve conflicts with master
mistic Jun 30, 2020
1afef13
chore(NA): merge and solve conflicts with master
mistic Jun 30, 2020
23c1978
chore(NA): merge and solve conflicts with master
mistic Jun 30, 2020
755166e
Merge remote-tracking branch 'upstream/master' into upgrade-lodash-4-…
mistic Jun 30, 2020
912793c
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jul 1, 2020
f5ee602
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jul 1, 2020
ac50d48
Upgrade lodash 4 vislib (#11)
stratoula Jul 1, 2020
a265153
chore(NA): upgrade data plugin to lodash4
mistic Jul 1, 2020
a35a21a
chore(NA): remove lodash3 completely from the repo
mistic Jul 2, 2020
bdda7d5
chore(NA): merge and solve conflicts with master
mistic Jul 2, 2020
9a775d8
chore(NA): fix x-pack/test/api_integration/apis/metrics_ui/snapshot.t…
mistic Jul 2, 2020
fc13937
Merge remote-tracking branch 'upstream/master' into upgrade-lodash-4-…
mistic Jul 2, 2020
ce56693
chore(NA): fix lodash usage on apm
mistic Jul 2, 2020
b1b9502
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jul 2, 2020
80a5f21
chore(NA): fix typecheck for maps
mistic Jul 2, 2020
15bbfee
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jul 2, 2020
dc10eb0
Patch lodash template (#12)
kobelb Jul 2, 2020
a0327dd
Merge branch 'master' into upgrade-lodash-4-final
elasticmachine Jul 2, 2020
68796f0
Ends up `_` is a function also... I hate JavaScript
kobelb Jul 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Serialize this format to a simple POJO, with only the params that are not defaul
```typescript
toJSON(): {
id: unknown;
params: _.Dictionary<unknown> | undefined;
params: import("lodash3").Dictionary<unknown> | undefined;
};
```
<b>Returns:</b>

`{
id: unknown;
params: _.Dictionary<unknown> | undefined;
params: import("lodash3").Dictionary<unknown> | undefined;
}`

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@
"**/@types/angular": "^1.6.56",
"**/@types/hoist-non-react-statics": "^3.3.1",
"**/@types/chai": "^4.2.11",
"**/cypress/@types/lodash": "^4.14.155",
"**/typescript": "3.9.5",
"**/graphql-toolkit/lodash": "^4.17.13",
"**/graphql-toolkit/lodash": "^4.17.15",
"**/hoist-non-react-statics": "^3.3.2",
"**/isomorphic-git/**/base64-js": "^1.2.1",
"**/image-diff/gm/debug": "^2.6.9",
Expand Down Expand Up @@ -212,8 +213,8 @@
"leaflet.heat": "0.2.0",
"less": "npm:@elastic/less@2.7.3-kibana",
"less-loader": "5.0.0",
"lodash": "npm:@elastic/lodash@3.10.1-kibana4",
"lodash.clonedeep": "^4.5.0",
"lodash": "^4.17.15",
"lodash3": "npm:@elastic/lodash@3.10.1-kibana4",
mistic marked this conversation as resolved.
Show resolved Hide resolved
"lru-cache": "4.1.5",
"markdown-it": "^10.0.0",
"mini-css-extract-plugin": "0.8.0",
Expand Down Expand Up @@ -354,8 +355,8 @@
"@types/json5": "^0.0.30",
"@types/license-checker": "15.0.0",
"@types/listr": "^0.14.0",
"@types/lodash": "^3.10.1",
"@types/lodash.clonedeep": "^4.5.4",
"@types/lodash": "^4.14.155",
"@types/lodash3": "npm:@types/lodash@^3.10.1",
"@types/lru-cache": "^5.1.0",
"@types/markdown-it": "^0.0.7",
"@types/minimatch": "^2.0.29",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-config-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"tsd": "^0.7.4"
},
"peerDependencies": {
"lodash": "^4.17.15",
"joi": "^13.5.2",
"moment": "^2.24.0",
"type-detect": "^4.0.8"
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-interpreter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"dependencies": {
"@babel/runtime": "^7.10.2",
"@kbn/i18n": "1.0.0",
"lodash": "npm:@elastic/lodash@3.10.1-kibana4",
"lodash.clone": "^4.5.0",
"lodash": "^4.17.15",
"uuid": "3.3.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-interpreter/src/common/lib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import clone from 'lodash.clone';
import { clone } from 'lodash';

export class Registry {
constructor(prop = 'name') {
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-plugin-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const dedent = require('dedent');
const sao = require('sao');
const chalk = require('chalk');
const getopts = require('getopts');
const snakeCase = require('lodash.snakecase');
const { snakeCase } = require('lodash');

exports.run = function run(argv) {
const options = getopts(argv, {
Expand All @@ -41,7 +41,7 @@ exports.run = function run(argv) {
if (options.help) {
console.log(
dedent(chalk`
# {dim Usage:}
# {dim Usage:}
node scripts/generate-plugin {bold [name]}
Generate a fresh Kibana plugin in the plugins/ directory
`) + '\n'
Expand Down
5 changes: 1 addition & 4 deletions packages/kbn-plugin-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
"dedent": "^0.7.0",
"execa": "^4.0.2",
"getopts": "^2.2.4",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"lodash.snakecase": "^4.1.1",
"lodash.startcase": "^4.4.0",
"lodash": "^4.17.15",
"sao": "^0.22.12"
}
}
4 changes: 1 addition & 3 deletions packages/kbn-plugin-generator/sao_template/sao.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
const { relative, resolve } = require('path');
const fs = require('fs');

const startCase = require('lodash.startcase');
const camelCase = require('lodash.camelcase');
const snakeCase = require('lodash.snakecase');
const { camelCase, startCase, snakeCase } = require('lodash');
const chalk = require('chalk');
const execa = require('execa');

Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@types/glob": "^5.0.35",
"@types/globby": "^6.1.0",
"@types/has-ansi": "^3.0.0",
"@types/lodash.clonedeepwith": "^4.5.3",
"@types/lodash": "^4.14.155",
"@types/log-symbols": "^2.0.0",
"@types/ncp": "^2.0.1",
"@types/node": ">=10.17.17 <10.20.0",
Expand All @@ -46,7 +46,7 @@
"globby": "^8.0.1",
"has-ansi": "^3.0.0",
"is-path-inside": "^3.0.2",
"lodash.clonedeepwith": "^4.5.0",
"lodash": "^4.17.15",
"log-symbols": "^2.2.0",
"multimatch": "^4.0.0",
"ncp": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import cloneDeepWith from 'lodash.clonedeepwith';
import { cloneDeepWith } from 'lodash';
import { resolve, sep as pathSep } from 'path';

const repoRoot = resolve(__dirname, '../../../../');
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-storybook/lib/webpack.dll.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module.exports = {
'highlight.js',
'html-entities',
'jquery',
'lodash.clone',
'lodash',
'markdown-it',
'mocha',
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@types/joi": "^13.4.2",
"@types/lodash": "^4.14.155",
"@types/parse-link-header": "^1.0.0",
"@types/puppeteer": "^3.0.0",
"@types/strip-ansi": "^5.2.1",
Expand All @@ -28,6 +29,7 @@
"getopts": "^2.2.4",
"glob": "^7.1.2",
"joi": "^13.5.2",
"lodash": "^4.17.15",
"parse-link-header": "^1.0.1",
"puppeteer": "^3.3.0",
"rxjs": "^6.5.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
*/

import { Schema } from 'joi';
import { cloneDeep, get, has } from 'lodash';

// @ts-ignore internal lodash module is not typed
import toPath from 'lodash/internal/toPath';
import { cloneDeepWith, get, has, toPath } from 'lodash';

import { schema } from './schema';

Expand Down Expand Up @@ -114,15 +111,15 @@ export class Config {
throw new Error(`Unknown config key "${key}"`);
}

return cloneDeep(get(this[$values], key, defaultValue), (v) => {
return cloneDeepWith(get(this[$values], key, defaultValue), (v) => {
if (typeof v === 'function') {
return v;
}
});
}

public getAll() {
return cloneDeep(this[$values], (v) => {
return cloneDeepWith(this[$values], (v) => {
if (typeof v === 'function') {
return v;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-test/src/legacy_es/legacy_es_test_cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

import { resolve } from 'path';
import { format } from 'url';
import { get } from 'lodash';
import toPath from 'lodash/internal/toPath';
import { get, toPath } from 'lodash';
import { Cluster } from '@kbn/es';
import { CI_PARALLEL_PROCESS_PREFIX } from '../ci_parallel_process_prefix';
import { esTestConfig } from './es_test_config';
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-test/src/page_load_metrics/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import Fs from 'fs';
import Url from 'url';
import _ from 'lodash';
import puppeteer from 'puppeteer';
import { resolve } from 'path';
import { ToolingLog } from '@kbn/dev-utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const sass = require('node-sass');
const postcss = require('postcss');
const postcssConfig = require('../../src/optimize/postcss.config');
const chokidar = require('chokidar');
const debounce = require('lodash/function/debounce');
const { debounce } = require('lodash');

const platform = require('os').platform();
const isPlatformWindows = /^win/.test(platform);
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"classnames": "2.2.6",
"focus-trap-react": "^3.1.1",
"lodash": "npm:@elastic/lodash@3.10.1-kibana4",
"lodash": "^4.17.15",
"prop-types": "15.6.0",
"react": "^16.12.0",
"react-ace": "^5.9.0",
Expand Down
16 changes: 4 additions & 12 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -558,19 +558,11 @@
],
},
{
groupSlug: 'lodash.clonedeep',
groupName: 'lodash.clonedeep related packages',
groupSlug: 'lodash3',
groupName: 'lodash3 related packages',
packageNames: [
'lodash.clonedeep',
'@types/lodash.clonedeep',
],
},
{
groupSlug: 'lodash.clonedeepwith',
groupName: 'lodash.clonedeepwith related packages',
packageNames: [
'lodash.clonedeepwith',
'@types/lodash.clonedeepwith',
'lodash3',
'@types/lodash3',
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/apm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const { join } = require('path');
const { readFileSync } = require('fs');
const { execSync } = require('child_process');
const merge = require('lodash.merge');
const { merge } = require('lodash');
const { name, version, build } = require('../package.json');

const ROOT_DIR = join(__dirname, '..');
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cluster/cluster_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('CLI cluster manager', () => {
}

const football = {};
const messenger = sample(manager.workers);
const messenger = sample(manager.workers) as any;

messenger.emit('broadcast', football);
for (const worker of manager.workers) {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cluster/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class Worker extends EventEmitter {
}

flushChangeBuffer() {
const files = _.unique(this.changes.splice(0));
const files = _.uniq(this.changes.splice(0));
const prefix = files.length > 1 ? '\n - ' : '';
return files.reduce(function (list, file) {
return `${list || ''}${prefix}"${file}"`;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function commandsSummary(program) {
}, 0);

return cmds.reduce(function (help, cmd) {
return `${help || ''}${_.padRight(cmd[0], cmdLColWidth)} ${cmd[1] || ''}\n`;
return `${help || ''}${_.padEnd(cmd[0], cmdLColWidth)} ${cmd[1] || ''}\n`;
}, '');
}

Expand Down
39 changes: 21 additions & 18 deletions src/core/public/http/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { merge } from 'lodash';
import { omitBy } from 'lodash';
import { format } from 'url';
import { BehaviorSubject } from 'rxjs';

Expand All @@ -42,6 +42,10 @@ interface Params {
const JSON_CONTENT = /^(application\/(json|x-javascript)|text\/(x-)?javascript|x-json)(;.*)?$/;
const NDJSON_CONTENT = /^(application\/ndjson)(;.*)?$/;

const removedUndefined = (obj: Record<string, any> | undefined) => {
return omitBy(obj, (v) => v === undefined);
};

export class Fetch {
private readonly interceptors = new Set<HttpInterceptor>();
private readonly requestCount$ = new BehaviorSubject(0);
Expand Down Expand Up @@ -119,32 +123,31 @@ export class Fetch {
asResponse,
asSystemRequest,
...fetchOptions
} = merge(
{
method: 'GET',
credentials: 'same-origin',
prependBasePath: true,
},
options,
{
headers: {
'Content-Type': 'application/json',
...options.headers,
'kbn-version': this.params.kibanaVersion,
},
}
);
} = {
method: 'GET',
credentials: 'same-origin',
prependBasePath: true,
...options,
// options can pass an `undefined` Content-Type to erase the default value.
// however we can't pass it to `fetch` as it will send an `Content-Type: Undefined` header
headers: removedUndefined({
'Content-Type': 'application/json',
...options.headers,
'kbn-version': this.params.kibanaVersion,
}),
};

const url = format({
pathname: shouldPrependBasePath ? this.params.basePath.prepend(options.path) : options.path,
query,
query: removedUndefined(query),
});

// Make sure the system request header is only present if `asSystemRequest` is true.
if (asSystemRequest) {
fetchOptions.headers['kbn-system-request'] = 'true';
}

return new Request(url, fetchOptions);
return new Request(url, fetchOptions as RequestInit);
}

private async fetchResponse(fetchOptions: HttpFetchOptionsWithPath): Promise<HttpResponse<any>> {
Expand Down
10 changes: 8 additions & 2 deletions src/core/public/plugins/plugins_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ describe('PluginsService', () => {
context: contextServiceMock.createSetupContract(),
fatalErrors: fatalErrorsServiceMock.createSetupContract(),
http: httpServiceMock.createSetupContract(),
injectedMetadata: pick(injectedMetadataServiceMock.createStartContract(), 'getInjectedVar'),
injectedMetadata: pick(
injectedMetadataServiceMock.createStartContract(),
'getInjectedVar'
) as any,
notifications: notificationServiceMock.createSetupContract(),
uiSettings: uiSettingsServiceMock.createSetupContract(),
};
Expand All @@ -106,7 +109,10 @@ describe('PluginsService', () => {
http: httpServiceMock.createStartContract(),
chrome: chromeServiceMock.createStartContract(),
i18n: i18nServiceMock.createStartContract(),
injectedMetadata: pick(injectedMetadataServiceMock.createStartContract(), 'getInjectedVar'),
injectedMetadata: pick(
injectedMetadataServiceMock.createStartContract(),
'getInjectedVar'
) as any,
notifications: notificationServiceMock.createStartContract(),
overlays: overlayServiceMock.createStartContract(),
uiSettings: uiSettingsServiceMock.createStartContract(),
Expand Down
4 changes: 3 additions & 1 deletion src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ export class SavedObjectsClient {
});

if (!foundObject) {
return queueItem.resolve(this.createSavedObject(pick(queueItem, ['id', 'type'])));
return queueItem.resolve(
this.createSavedObject(pick(queueItem, ['id', 'type']) as SavedObject)
);
}

queueItem.resolve(foundObject);
Expand Down
Loading