From 3a57c402dc39a57a0d2ecf6831efaa8d17dd50ee Mon Sep 17 00:00:00 2001 From: nmin Date: Mon, 7 Oct 2024 08:15:47 -0400 Subject: [PATCH 1/3] fix: process is not defined in browser env --- etc/browser/lib/platform.js | 10 ---------- lib/platform.js | 2 -- lib/types.js | 5 +---- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/etc/browser/lib/platform.js b/etc/browser/lib/platform.js index 64c9d388..12c7dacf 100644 --- a/etc/browser/lib/platform.js +++ b/etc/browser/lib/platform.js @@ -24,17 +24,7 @@ function deprecate (fn) { return fn; } -/** - * Browser stub for debuglog(). Never does any logging. - * @returns A function that can be called with log messages. Does nothing with - * those messages. - */ -function debuglog () { - return () => {}; -} - module.exports = { getHash, deprecate, - debuglog }; diff --git a/lib/platform.js b/lib/platform.js index d94ec18c..b9294f86 100644 --- a/lib/platform.js +++ b/lib/platform.js @@ -1,5 +1,4 @@ let crypto = require('crypto'); -let util = require('util'); /** * Compute a string's hash. @@ -17,5 +16,4 @@ function getHash(str, algorithm) { module.exports = { getHash, - debuglog: util.debuglog }; diff --git a/lib/types.js b/lib/types.js index 1e15acfc..87d2c252 100644 --- a/lib/types.js +++ b/lib/types.js @@ -17,7 +17,6 @@ let utils = require('./utils'), // Convenience imports. let {Tap, isBufferLike} = utils; -let debug = platform.debuglog('avsc:types'); let j = utils.printJSON; // All non-union concrete (i.e. non-logical) Avro types. @@ -172,10 +171,9 @@ class Type { registry[key] = opts.registry[key]; }); try { - debug('instantiating logical type for %s', schema.logicalType); return new DerivedType(schema, opts); } catch (err) { - debug('failed to instantiate logical type for %s', schema.logicalType); + console.error('failed to instantiate logical type for %s', schema.logicalType); if (opts.assertLogicalTypes) { // The spec mandates that we fall through to the underlying type if // the logical type is invalid. We provide this option to ease @@ -449,7 +447,6 @@ class Type { } static __reset (size) { - debug('resetting type buffer to %d', size); TAP.reinitialize(size); } From 98270152afa767051a2c53d472bea9929245e1d3 Mon Sep 17 00:00:00 2001 From: nmin Date: Mon, 7 Oct 2024 08:18:37 -0400 Subject: [PATCH 2/3] refactor: remove redundant line --- lib/types.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/types.js b/lib/types.js index 87d2c252..653a4e32 100644 --- a/lib/types.js +++ b/lib/types.js @@ -12,8 +12,7 @@ * */ -let utils = require('./utils'), - platform = require('./platform'); +let utils = require('./utils'); // Convenience imports. let {Tap, isBufferLike} = utils; From 1653c1d48825ae09f4622f15feee5aad41d5cb47 Mon Sep 17 00:00:00 2001 From: nmin Date: Tue, 8 Oct 2024 10:31:13 -0400 Subject: [PATCH 3/3] refactor: address comment --- lib/types.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/types.js b/lib/types.js index 653a4e32..ee17b5ef 100644 --- a/lib/types.js +++ b/lib/types.js @@ -172,7 +172,6 @@ class Type { try { return new DerivedType(schema, opts); } catch (err) { - console.error('failed to instantiate logical type for %s', schema.logicalType); if (opts.assertLogicalTypes) { // The spec mandates that we fall through to the underlying type if // the logical type is invalid. We provide this option to ease