Comparing version 1.6.1 to 1.6.2
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
exports.__esModule = true; | ||
exports.Registry = void 0; | ||
var double_indexed_kv_1 = require("./double-indexed-kv"); | ||
var debug_1 = __importDefault(require("debug")); | ||
var debug = debug_1["default"]('superjson'); | ||
var Registry = /** @class */ (function () { | ||
@@ -20,3 +25,3 @@ function Registry(generateIdentifier) { | ||
if (alreadyRegistered && alreadyRegistered !== value) { | ||
console.warn("Ambiguous class \"" + identifier + "\", provide a unique identifier."); | ||
debug("Ambiguous class \"" + identifier + "\", provide a unique identifier."); | ||
} | ||
@@ -23,0 +28,0 @@ } |
@@ -167,3 +167,3 @@ "use strict"; | ||
if (!clazz) { | ||
throw new Error('Trying to deserialize unknown class'); | ||
throw new Error('Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564'); | ||
} | ||
@@ -170,0 +170,0 @@ return Object.assign(Object.create(clazz.prototype), v); |
{ | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"license": "MIT", | ||
@@ -19,3 +19,2 @@ "main": "dist/index.js", | ||
}, | ||
"peerDependencies": {}, | ||
"husky": { | ||
@@ -61,2 +60,3 @@ "hooks": { | ||
"devDependencies": { | ||
"@types/debug": "^4.1.5", | ||
"@types/lodash": "^4.14.168", | ||
@@ -71,3 +71,5 @@ "@types/mongodb": "^3.6.3", | ||
}, | ||
"dependencies": {}, | ||
"dependencies": { | ||
"debug": "^4.3.1" | ||
}, | ||
"resolutions": { | ||
@@ -74,0 +76,0 @@ "**/@typescript-eslint/eslint-plugin": "^4.11.1", |
@@ -0,1 +1,2 @@ | ||
import debug from 'debug'; | ||
import { Registry } from './registry'; | ||
@@ -19,6 +20,8 @@ import { Class } from './types'; | ||
const warnSpy = jest.spyOn(console, 'warn'); | ||
debug.enable('superjson'); | ||
const warnSpy = jest.spyOn(process.stderr, 'write'); | ||
registry.register(class Car {}); | ||
expect(warnSpy).toHaveBeenCalledWith( | ||
expect(warnSpy).toHaveBeenCalledTimes(1); | ||
expect(warnSpy.mock.calls[0][0]).toContain( | ||
'Ambiguous class "Car", provide a unique identifier.' | ||
@@ -25,0 +28,0 @@ ); |
import { DoubleIndexedKV } from './double-indexed-kv'; | ||
import createDebug from 'debug'; | ||
const debug = createDebug('superjson'); | ||
export class Registry<T> { | ||
@@ -20,5 +23,3 @@ private kv = new DoubleIndexedKV<string, T>(); | ||
if (alreadyRegistered && alreadyRegistered !== value) { | ||
console.warn( | ||
`Ambiguous class "${identifier}", provide a unique identifier.` | ||
); | ||
debug(`Ambiguous class "${identifier}", provide a unique identifier.`); | ||
} | ||
@@ -25,0 +26,0 @@ } |
@@ -254,3 +254,5 @@ import { | ||
if (!clazz) { | ||
throw new Error('Trying to deserialize unknown class'); | ||
throw new Error( | ||
'Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564' | ||
); | ||
} | ||
@@ -257,0 +259,0 @@ |
Sorry, the diff of this file is not supported yet
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
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
158327
3609
1
9
+ Addeddebug@^4.3.1
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)