Comments (9)
@cristobal if you do start working on this issue feel free to take a look at my attempt I made a couple of weeks ago: bf616b5. As you said, I had to get rid of bs58
, but base-x
itself did not have ESM support either so I tried to temporarily copy its content in place. The end result seemed to work fine with vite, so I am not sure if we actually need to do anything about bn.js
and text-encoding-utf-8
, but I could very well be wrong.
from borsh-js.
Ok will start working on this next week, if i manage to get some time free this weekend i will look into it but otherwise expect some PR's from next week 🙂 👍🏽
from borsh-js.
Thanks, @cristobal ! Let's move step by step.
We can merge breaking changes to a separate branch and then release them together with a new major version update.
from borsh-js.
Let's add ESM alongside CJS to this project. Can be a requirement for near/near-api-js#607 cc @itegulov
Why not remove dependency on text-encoding-utf-8
and make it an optional polyfill, since the module actually does not export an default which is the one used here
// TODO: Make sure this polyfill not included when not required
import * as encoding from "text-encoding-utf-8";
Leaving this part out or modifying the text-encoding-utf-8 to include a default export, works when building with Esbuild or Snowpack i commented this in #47.
from borsh-js.
Perhaps some contribution to both the bn.js and bs58 to have proper esm build and exports?
Not sure if bs58 should be an dependency, due to the few lines of code:
const basex = require('base-x')
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
module.exports = basex(ALPHABET)
perhaps rather just depend on base-x
instead?
from borsh-js.
@cristobal looks reasonable! Do you think you can create a PR?
from borsh-js.
@cristobal looks reasonable! Do you think you can create a PR?
Sure could try do make some PR's, what do you prefer one big PR or several smaller changes?
- Replacing bs58 by using base-x directly would not be that hard and could be a minor upgrade.
- Removing text-encoding-utf-8 and specifying it as a polyfill where needed is a major upgrade since it would require those that need to support older browsers have to manually polyfill it.
- I think bn.js may be a bit trickier related issue on ethers.js with esm build.
@volovyk-s Thoughts on the process?
from borsh-js.
@cristobal I have created develop-breaking
branch for breaking changes. You can target it in your PR's.
from borsh-js.
Supported in 1.0!
from borsh-js.
Related Issues (20)
- Schema for nested struct (classes) HOT 5
- Can I use borsh-js directly from HTML script tag instead of node? HOT 1
- How to serialize UnorderedMap (Map)? HOT 1
- deserialize method not allowing Class implementation for classType parameter
- deserialize method not mapping properties properly HOT 1
- How to serialize or create schema for vec of structs HOT 1
- CI is not working HOT 1
- yarn build and yarn test fails
- TypeError: reader[capitalizeFirstLetter(...)] is not a function HOT 2
- Deserializing Option type should return null in the None case HOT 1
- Schemaless serialization? HOT 1
- Serialize primitives (not structs)? HOT 2
- Security Policy violation Branch Protection HOT 2
- Security Policy violation SECURITY.md HOT 2
- Deserialize requires type assertion HOT 2
- Non-ASCII characters not being properly serialized HOT 2
- How to deserialize enum? HOT 1
- Enum schema failed with typescript check when (de)serialize HOT 2
- How to (de)serialize unnamed fields HOT 2
- Type is not strict when serialize `u64` or `u128` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from borsh-js.