🐛 Replace jsonBigint with lossless-json (#2006)

This commit is contained in:
David Saunders 2024-04-09 21:45:44 +01:00 committed by GitHub
parent 484f6ef0c1
commit 920c490548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 6 deletions

15
package-lock.json generated
View File

@ -19,7 +19,8 @@
"packages/bruno-graphql-docs" "packages/bruno-graphql-docs"
], ],
"dependencies": { "dependencies": {
"json-bigint": "^1.0.0" "json-bigint": "^1.0.0",
"lossless-json": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"@faker-js/faker": "^7.6.0", "@faker-js/faker": "^7.6.0",
@ -12471,6 +12472,11 @@
"loose-envify": "cli.js" "loose-envify": "cli.js"
} }
}, },
"node_modules/lossless-json": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.1.tgz",
"integrity": "sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA=="
},
"node_modules/loupe": { "node_modules/loupe": {
"version": "2.3.7", "version": "2.3.7",
"license": "MIT", "license": "MIT",
@ -19676,7 +19682,7 @@
}, },
"packages/bruno-electron": { "packages/bruno-electron": {
"name": "bruno", "name": "bruno",
"version": "v1.11.0", "version": "v1.12.3",
"dependencies": { "dependencies": {
"@aws-sdk/credential-providers": "3.525.0", "@aws-sdk/credential-providers": "3.525.0",
"@usebruno/common": "0.1.0", "@usebruno/common": "0.1.0",
@ -30815,6 +30821,11 @@
"js-tokens": "^3.0.0 || ^4.0.0" "js-tokens": "^3.0.0 || ^4.0.0"
} }
}, },
"lossless-json": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.1.tgz",
"integrity": "sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA=="
},
"loupe": { "loupe": {
"version": "2.3.7", "version": "2.3.7",
"requires": { "requires": {

View File

@ -47,10 +47,12 @@
"test:prettier:web": "npm run test:prettier --workspace=packages/bruno-app", "test:prettier:web": "npm run test:prettier --workspace=packages/bruno-app",
"prepare": "husky install" "prepare": "husky install"
}, },
"overrides": { "overrides": {
"rollup": "3.2.5" "rollup": "3.2.5"
}, },
"dependencies": { "dependencies": {
"json-bigint": "^1.0.0" "json-bigint": "^1.0.0",
"lossless-json": "^4.0.1"
} }
} }

View File

@ -8,7 +8,7 @@ import { humanizeRequestBodyMode } from 'utils/collections';
import StyledWrapper from './StyledWrapper'; import StyledWrapper from './StyledWrapper';
import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index'; import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index';
import { toastError } from 'utils/common/error'; import { toastError } from 'utils/common/error';
import jsonBigint from 'json-bigint'; import { parse, stringify } from 'lossless-json';
const RequestBodyMode = ({ item, collection }) => { const RequestBodyMode = ({ item, collection }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
@ -38,8 +38,8 @@ const RequestBodyMode = ({ item, collection }) => {
const onPrettify = () => { const onPrettify = () => {
if (body?.json && bodyMode === 'json') { if (body?.json && bodyMode === 'json') {
try { try {
const bodyJson = jsonBigint.parse(body.json); const bodyJson = parse(body.json);
const prettyBodyJson = jsonBigint.stringify(bodyJson, null, 2); const prettyBodyJson = stringify(bodyJson, null, 2);
dispatch( dispatch(
updateRequestBody({ updateRequestBody({
content: prettyBodyJson, content: prettyBodyJson,