fix(deps): update dependency jsondiffpatch to ^0.6.0 (#1586)

* fix(deps): update dependency jsondiffpatch to ^0.6.0

* Cleanup renovate.json

* Code updates

* Update test config

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nathan Bierema <nbierema@gmail.com>
This commit is contained in:
renovate[bot] 2024-01-23 21:48:11 -05:00 committed by GitHub
parent 31aabfa82c
commit 9e4e054f8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 42 additions and 44 deletions

View File

@ -6,6 +6,6 @@ module.exports = {
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts', '\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
}, },
transformIgnorePatterns: [ transformIgnorePatterns: [
'node_modules/(?!.pnpm|@babel/code-frame|@babel/highlight|@babel/helper-validator-identifier|chalk|d3|dateformat|delaunator|internmap|nanoid|robust-predicates|uuid)', 'node_modules/(?!.pnpm|@babel/code-frame|@babel/highlight|@babel/helper-validator-identifier|chalk|d3|dateformat|delaunator|internmap|jsondiffpatch|nanoid|robust-predicates|uuid)',
], ],
}; };

View File

@ -10,6 +10,6 @@ module.exports = {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }], '^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
}, },
transformIgnorePatterns: [ transformIgnorePatterns: [
'node_modules/(?!.pnpm|@babel/code-frame|@babel/highlight|@babel/helper-validator-identifier|chalk|d3|dateformat|delaunator|internmap|nanoid|robust-predicates|uuid)', 'node_modules/(?!.pnpm|@babel/code-frame|@babel/highlight|@babel/helper-validator-identifier|chalk|d3|dateformat|delaunator|internmap|jsondiffpatch|nanoid|robust-predicates|uuid)',
], ],
}; };

View File

@ -54,7 +54,7 @@
"d3-state-visualizer": "^2.0.0", "d3-state-visualizer": "^2.0.0",
"javascript-stringify": "^2.1.0", "javascript-stringify": "^2.1.0",
"jsan": "^3.1.14", "jsan": "^3.1.14",
"jsondiffpatch": "^0.5.0", "jsondiffpatch": "^0.6.0",
"localforage": "^1.10.0", "localforage": "^1.10.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react-icons": "^5.0.1", "react-icons": "^5.0.1",

View File

@ -13,7 +13,7 @@ import RawTab from './RawTab';
import ChartTab from './ChartTab'; import ChartTab from './ChartTab';
import VisualDiffTab from './VisualDiffTab'; import VisualDiffTab from './VisualDiffTab';
import { StoreState } from '../../../reducers'; import { StoreState } from '../../../reducers';
import { Delta } from 'jsondiffpatch'; import type { Delta } from 'jsondiffpatch';
type StateProps = ReturnType<typeof mapStateToProps>; type StateProps = ReturnType<typeof mapStateToProps>;
type DispatchProps = ResolveThunks<typeof actionCreators>; type DispatchProps = ResolveThunks<typeof actionCreators>;

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Delta, formatters } from 'jsondiffpatch'; import type { Delta } from 'jsondiffpatch';
import * as htmlFormatter from 'jsondiffpatch/formatters/html';
import styled, { ThemedStyledProps } from 'styled-components'; import styled, { ThemedStyledProps } from 'styled-components';
import { effects, Theme } from '@redux-devtools/ui'; import { effects, Theme } from '@redux-devtools/ui';
@ -240,7 +241,7 @@ export default class VisualDiffTab extends Component<Props> {
let __html: string | undefined; let __html: string | undefined;
const data = this.props.data; const data = this.props.data;
if (data) { if (data) {
__html = formatters.html.format(data, undefined); __html = htmlFormatter.format(data, undefined);
} }
return <StyledContainer dangerouslySetInnerHTML={{ __html: __html! }} />; return <StyledContainer dangerouslySetInnerHTML={{ __html: __html! }} />;

View File

@ -46,7 +46,7 @@
"hex-rgba": "^1.0.2", "hex-rgba": "^1.0.2",
"immutable": "^4.3.4", "immutable": "^4.3.4",
"javascript-stringify": "^2.1.0", "javascript-stringify": "^2.1.0",
"jsondiffpatch": "^0.5.0", "jsondiffpatch": "^0.6.0",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"react-base16-styling": "^0.9.1", "react-base16-styling": "^0.9.1",
"react-json-tree": "^0.18.0", "react-json-tree": "^0.18.0",

View File

@ -3,7 +3,7 @@ import { Base16Theme } from 'redux-devtools-themes';
import { Action } from 'redux'; import { Action } from 'redux';
import type { LabelRenderer } from 'react-json-tree'; import type { LabelRenderer } from 'react-json-tree';
import { PerformAction } from '@redux-devtools/core'; import { PerformAction } from '@redux-devtools/core';
import { Delta } from 'jsondiffpatch'; import type { Delta } from 'jsondiffpatch';
import type { JSX } from '@emotion/react/jsx-runtime'; import type { JSX } from '@emotion/react/jsx-runtime';
import { DEFAULT_STATE, DevtoolsInspectorState } from './redux'; import { DEFAULT_STATE, DevtoolsInspectorState } from './redux';
import ActionPreviewHeader from './ActionPreviewHeader'; import ActionPreviewHeader from './ActionPreviewHeader';

View File

@ -6,7 +6,7 @@ import {
LiftedState, LiftedState,
} from '@redux-devtools/core'; } from '@redux-devtools/core';
import { Action, Dispatch } from 'redux'; import { Action, Dispatch } from 'redux';
import { Delta, DiffContext } from 'jsondiffpatch'; import type { Delta, DiffContext } from 'jsondiffpatch';
import { import {
createInspectorMonitorThemeFromBase16Theme, createInspectorMonitorThemeFromBase16Theme,
resolveBase16Theme, resolveBase16Theme,
@ -154,7 +154,7 @@ export interface DevtoolsInspectorProps<S, A extends Action<string>>
select: (state: S) => unknown; select: (state: S) => unknown;
theme: Base16ThemeName | Base16Theme; theme: Base16ThemeName | Base16Theme;
supportImmutable: boolean; supportImmutable: boolean;
diffObjectHash?: (item: unknown, index: number) => string; diffObjectHash?: (item: unknown, index: number | undefined) => string;
diffPropertyFilter?: (name: string, context: DiffContext) => boolean; diffPropertyFilter?: (name: string, context: DiffContext) => boolean;
hideMainButtons?: boolean; hideMainButtons?: boolean;
hideActionButtons?: boolean; hideActionButtons?: boolean;

View File

@ -1,14 +1,19 @@
import { DiffContext, DiffPatcher } from 'jsondiffpatch'; import { DiffPatcher } from 'jsondiffpatch';
import type { DiffContext } from 'jsondiffpatch';
const defaultObjectHash = (o: any, idx: number) => const defaultObjectHash = (obj: object, idx: number | undefined) => {
const o = obj as Record<string, unknown>;
return (
(o === null && '$$null') || (o === null && '$$null') ||
(o && (o.id || o.id === 0) && `$$id:${JSON.stringify(o.id)}`) || (o && (o.id || o.id === 0) && `$$id:${JSON.stringify(o.id)}`) ||
(o && (o._id || o._id === 0) && `$$_id:${JSON.stringify(o._id)}`) || (o && (o._id || o._id === 0) && `$$_id:${JSON.stringify(o._id)}`) ||
`$$index:${idx}`; `$$index:${idx}`
);
};
const defaultPropertyFilter = (name: string, context: DiffContext) => const defaultPropertyFilter = (name: string, context: DiffContext) =>
typeof context.left[name] !== 'function' && typeof (context.left as Record<string, unknown>)[name] !== 'function' &&
typeof context.right[name] !== 'function'; typeof (context.right as Record<string, unknown>)[name] !== 'function';
const defaultDiffPatcher = new DiffPatcher({ const defaultDiffPatcher = new DiffPatcher({
arrays: { detectMove: false } as { arrays: { detectMove: false } as {
@ -20,7 +25,9 @@ const defaultDiffPatcher = new DiffPatcher({
}); });
export default function createDiffPatcher( export default function createDiffPatcher(
objectHash: ((item: unknown, index: number) => string) | undefined, objectHash:
| ((item: unknown, index: number | undefined) => string)
| undefined,
propertyFilter: ((name: string, context: DiffContext) => boolean) | undefined, propertyFilter: ((name: string, context: DiffContext) => boolean) | undefined,
) { ) {
if (!objectHash && !propertyFilter) { if (!objectHash && !propertyFilter) {

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { JSONTree } from 'react-json-tree'; import { JSONTree } from 'react-json-tree';
import type { LabelRenderer, ShouldExpandNodeInitially } from 'react-json-tree'; import type { LabelRenderer, ShouldExpandNodeInitially } from 'react-json-tree';
import { stringify } from 'javascript-stringify'; import { stringify } from 'javascript-stringify';
import { Delta } from 'jsondiffpatch'; import type { Delta } from 'jsondiffpatch';
import { Base16Theme } from 'redux-devtools-themes'; import { Base16Theme } from 'redux-devtools-themes';
import { css } from '@emotion/react'; import { css } from '@emotion/react';
import type { Interpolation, Theme } from '@emotion/react'; import type { Interpolation, Theme } from '@emotion/react';

View File

@ -1043,8 +1043,8 @@ importers:
specifier: ^3.1.14 specifier: ^3.1.14
version: 3.1.14 version: 3.1.14
jsondiffpatch: jsondiffpatch:
specifier: ^0.5.0 specifier: ^0.6.0
version: 0.5.0 version: 0.6.0
localforage: localforage:
specifier: ^1.10.0 specifier: ^1.10.0
version: 1.10.0 version: 1.10.0
@ -1612,8 +1612,8 @@ importers:
specifier: ^2.1.0 specifier: ^2.1.0
version: 2.1.0 version: 2.1.0
jsondiffpatch: jsondiffpatch:
specifier: ^0.5.0 specifier: ^0.6.0
version: 0.5.0 version: 0.6.0
lodash.debounce: lodash.debounce:
specifier: ^4.0.8 specifier: ^4.0.8
version: 4.0.8 version: 4.0.8
@ -10064,6 +10064,10 @@ packages:
resolution: {integrity: sha512-Rf3/lB9WkDfIL9eEKaSYKc+1L/rNVYBjThk22JTqQw0YozXarX8YljFAz+HCoC6h4B4KwCMsBPZHaFezwT4BNA==} resolution: {integrity: sha512-Rf3/lB9WkDfIL9eEKaSYKc+1L/rNVYBjThk22JTqQw0YozXarX8YljFAz+HCoC6h4B4KwCMsBPZHaFezwT4BNA==}
dev: true dev: true
/@types/diff-match-patch@1.0.36:
resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==}
dev: false
/@types/doctrine@0.0.3: /@types/doctrine@0.0.3:
resolution: {integrity: sha512-w5jZ0ee+HaPOaX25X2/2oGR/7rgAQSYII7X7pp0m9KgBfMP7uKfMfTvcpl5Dj+eDBbpxKGiqE+flqDr6XTd2RA==} resolution: {integrity: sha512-w5jZ0ee+HaPOaX25X2/2oGR/7rgAQSYII7X7pp0m9KgBfMP7uKfMfTvcpl5Dj+eDBbpxKGiqE+flqDr6XTd2RA==}
dev: true dev: true
@ -12019,6 +12023,7 @@ packages:
dependencies: dependencies:
ansi-styles: 4.3.0 ansi-styles: 4.3.0
supports-color: 7.2.0 supports-color: 7.2.0
dev: true
/chalk@4.1.2: /chalk@4.1.2:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
@ -16477,15 +16482,15 @@ packages:
resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==}
dev: true dev: true
/jsondiffpatch@0.5.0: /jsondiffpatch@0.6.0:
resolution: {integrity: sha512-Quz3MvAwHxVYNXsOByL7xI5EB2WYOeFswqaHIA3qOK3isRWTxiplBEocmmru6XmxDB2L7jDNYtYA4FyimoAFEw==} resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==}
engines: {node: '>=8.17.0'} engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true hasBin: true
dependencies: dependencies:
chalk: 3.0.0 '@types/diff-match-patch': 1.0.36
chalk: 5.3.0
diff-match-patch: 1.0.5 diff-match-patch: 1.0.5
dev: false dev: false
bundledDependencies: []
/jsonfile@4.0.0: /jsonfile@4.0.0:
resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==}

View File

@ -22,11 +22,6 @@
"matchUpdateTypes": ["major", "minor"], "matchUpdateTypes": ["major", "minor"],
"groupName": "source-map" "groupName": "source-map"
}, },
{
"matchPackageNames": ["jsondiffpatch"],
"matchUpdateTypes": ["major", "minor"],
"groupName": "jsondiffpatch"
},
{ {
"matchPackageNames": ["msw"], "matchPackageNames": ["msw"],
"groupName": "msw" "groupName": "msw"
@ -40,16 +35,6 @@
], ],
"matchUpdateTypes": ["major"], "matchUpdateTypes": ["major"],
"groupName": "redux" "groupName": "redux"
},
{
"matchPackageNames": [
"socketcluster-client",
"@types/socketcluster-client",
"socketcluster-server",
"@types/socketcluster-server"
],
"matchUpdateTypes": ["major"],
"groupName": "socketcluster"
} }
] ]
} }