Closed valadaptive closed 1 year ago
Did you use a tool to do the translation? I'm curious how difficult it would be to swap the
let
s forconst
s where possible.
The translation to ES6 class syntax was done manually. The translation from var
to let
was done by enabling ESLint's no-var
rule, letting ESLint autofix as many cases as possible and manually going over the rest.
There are tools like lebab that can automatically convert to ES6 classes as well, but it seems much less well-maintained than ESLint, so I opted to go with ESLint + the manual approach.
It should be fairly easy to use const
where possible--ESLint has a prefer-const
rule which has an autofix available.
Thank you very much for this @valadaptive! Follow up release PR: https://github.com/mtth/avsc/pull/428
This PR does a few things:
avro.Type
classes (especiallyLogicalType
) must use ES6extends
.util
has been almost entirely removed.deprecate
anddebuglog
are the only remaining use cases, and they're put behind shims that are no-ops in the browser.path
has been abstracted behind the existingfiles.js
compatibility layer.zlib
has been removed by removing'deflate'
as a default codec, which is the second breaking change. Fortunately, it's very easy to add back for any API consumers--they can just pass inzlib.[in/de]flateRaw
as the codec.buffer
andstream
, which have robust polyfills currently available on NPM. Removing these two dependencies,buffer
especially, is a more complex undertaking, but I feel better about importing them since they're a core part of the API surface when compared to, say,zlib
, which was essentially only imported on behalf of the API consumer.let
statements are lexically scoped, and deprecatednew Buffer
calls have been completely removed now that Node < 6 no longer needs to be supported.toBuffer
which results in a ~30% performance improvement. Overall, this PR seems to be within the regular margin of error for performance, with some tests slightly improving and others slightly worsening, but I found an optimization just to be on the safe side.