Comparing version 1.7.2 to 1.7.3-dont-mutate-serialize
@@ -13,2 +13,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
exports.__esModule = true; | ||
@@ -21,2 +24,3 @@ exports.parse = exports.deserialize = exports.serialize = void 0; | ||
var plainer_1 = require("./plainer"); | ||
var lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); | ||
var serialize = function (object) { | ||
@@ -40,3 +44,3 @@ var identities = new Map(); | ||
var json = payload.json, meta = payload.meta; | ||
var result = json; | ||
var result = lodash_clonedeep_1["default"](json); | ||
if (meta === null || meta === void 0 ? void 0 : meta.values) { | ||
@@ -43,0 +47,0 @@ result = plainer_1.applyValueAnnotations(result, meta.values); |
{ | ||
"version": "1.7.2", | ||
"version": "1.7.3-dont-mutate-serialize", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"module": "dist/esm/index.js", | ||
"files": [ | ||
@@ -14,12 +15,10 @@ "dist", | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "yarn build:cjs && yarn build:esm", | ||
"build:cjs": "tsc", | ||
"build:esm": "tsc --module es2015 --outDir dist/esm", | ||
"test": "tsdx test --notify --verbose", | ||
"lint": "tsdx lint", | ||
"prepack": "tsc" | ||
"prepack": "yarn build", | ||
"prepare": "husky install" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "tsdx lint" | ||
} | ||
}, | ||
"importSort": { | ||
@@ -54,3 +53,2 @@ ".ts": { | ||
], | ||
"module": "dist/superjson.esm.js", | ||
"repository": { | ||
@@ -63,12 +61,14 @@ "type": "git", | ||
"@types/lodash": "^4.14.168", | ||
"@types/lodash.clonedeep": "^4.5.6", | ||
"@types/mongodb": "^3.6.7", | ||
"benchmark": "^2.1.4", | ||
"eslint-plugin-es5": "^1.5.0", | ||
"husky": "^4.3.8", | ||
"husky": "^5.0.9", | ||
"mongodb": "^3.6.4", | ||
"tsdx": "^0.14.1", | ||
"typescript": "^4.1.3" | ||
"typescript": "^4.1.5" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.3.1" | ||
"debug": "^4.3.1", | ||
"lodash.clonedeep": "^4.5.0" | ||
}, | ||
@@ -75,0 +75,0 @@ "resolutions": { |
@@ -11,3 +11,3 @@ <p align="center"> | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
<a href="#contributors"><img src="https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square" alt="All Contributors"/></a> | ||
<a href="#contributors"><img src="https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square" alt="All Contributors"/></a> | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -243,2 +243,4 @@ <a href="https://www.npmjs.com/package/superjson"> | ||
<td align="center"><a href="http://twitter.com/_markeh"><img src="https://avatars.githubusercontent.com/u/1357323?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mark Hughes</b></sub></a><br /><a href="https://github.com/blitz-js/superjson/issues?q=author%3Amarkhughes" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="https://blog.lxxyx.cn/"><img src="https://avatars.githubusercontent.com/u/13161470?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lxxyx</b></sub></a><br /><a href="https://github.com/blitz-js/superjson/commits?author=Lxxyx" title="Code">💻</a></td> | ||
<td align="center"><a href="http://maximomussini.com"><img src="https://avatars.githubusercontent.com/u/1158253?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Máximo Mussini</b></sub></a><br /><a href="https://github.com/blitz-js/superjson/commits?author=ElMassimo" title="Code">💻</a></td> | ||
</tr> | ||
@@ -245,0 +247,0 @@ </table> |
@@ -850,2 +850,26 @@ /* eslint-disable es5/no-for-of */ | ||
test('regression https://github.com/blitz-js/babel-plugin-superjson-next/issues/63: Nested BigInt', () => { | ||
const serialized = SuperJSON.serialize({ | ||
topics: [ | ||
{ | ||
post_count: BigInt('22'), | ||
}, | ||
], | ||
}); | ||
expect(() => JSON.stringify(serialized)).not.toThrow(); | ||
expect(typeof (serialized.json as any).topics[0].post_count).toBe('string'); | ||
expect(serialized.json).toEqual({ | ||
topics: [ | ||
{ | ||
post_count: '22', | ||
}, | ||
], | ||
}); | ||
SuperJSON.deserialize(serialized); | ||
expect(typeof (serialized.json as any).topics[0].post_count).toBe('string'); | ||
}); | ||
test('performance regression', () => { | ||
@@ -852,0 +876,0 @@ const data: any[] = []; |
@@ -15,2 +15,3 @@ import { SuperJSONResult, SuperJSONValue, Class, JSONValue } from './types'; | ||
} from './plainer'; | ||
import cloneDeep from 'lodash.clonedeep'; | ||
@@ -47,3 +48,3 @@ export const serialize = (object: SuperJSONValue): SuperJSONResult => { | ||
let result: T = json as any; | ||
let result: T = cloneDeep(json) as any; | ||
@@ -50,0 +51,0 @@ if (meta?.values) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
195281
107
3957
260
2
10
2
2
+ Addedlodash.clonedeep@^4.5.0
+ Addedlodash.clonedeep@4.5.0(transitive)