Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crc-32 and JSON ESM import fix #6049

Merged
merged 5 commits into from
May 5, 2023
Merged

crc-32 and JSON ESM import fix #6049

merged 5 commits into from
May 5, 2023

Conversation

jdevcs
Copy link
Contributor

@jdevcs jdevcs commented Apr 27, 2023

Description

#6032
#6034

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run lint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:coverage and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have linked Issue(s) with this PR in "Linked Issues" menu.

import goerli from './chains/goerli.json';
import mainnet from './chains/mainnet.json';
import sepolia from './chains/sepolia.json';
import goerli from './chains/goerli' ;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use Static import with JSON import assertion it solves problem for ESM only, but as it creates another issue for CJS build outputs due to current configuration settings that we have, so I converted json to ts., supporting both ESM+CJS hybrid builds in our case plus users dnt need additional --experimental-json-modules.

@github-actions
Copy link

github-actions bot commented Apr 27, 2023

Bundle Stats

Hey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Asset Old size New size Diff Diff %
Total 709 KB 708 KB -851 bytes -0.12%
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset Old size New size Diff Diff %
web3.min.js 692 KB 691 KB -851 bytes -0.12%
../lib/commonjs/index.d.ts 8.43 KB 8.43 KB 0 0.00%
../lib/commonjs/accounts.d.ts 3.67 KB 3.67 KB 0 0.00%
../lib/commonjs/types.d.ts 2.37 KB 2.37 KB 0 0.00%
../lib/commonjs/abi.d.ts 1000 bytes 1000 bytes 0 0.00%
../lib/commonjs/web3.d.ts 808 bytes 808 bytes 0 0.00%
../lib/commonjs/eth.exports.d.ts 280 bytes 280 bytes 0 0.00%
../lib/commonjs/providers.exports.d.ts 148 bytes 148 bytes 0 0.00%
../lib/commonjs/version.d.ts 60 bytes 60 bytes 0 0.00%

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 27, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: c8f1fac
Status: ✅  Deploy successful!
Preview URL: https://d7e21476.web3-js-docs.pages.dev
Branch Preview URL: https://junaid-esmimportfix4x.web3-js-docs.pages.dev

View logs

@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

Merging #6049 (c8f1fac) into 4.x (476fe2e) will increase coverage by 85.98%.
The diff coverage is 95.55%.

Additional details and impacted files
@@           Coverage Diff            @@
##           4.x    #6049       +/-   ##
========================================
+ Coverage     0   85.98%   +85.98%     
========================================
  Files        0      203      +203     
  Lines        0     7522     +7522     
  Branches     0     2022     +2022     
========================================
+ Hits         0     6468     +6468     
- Misses       0     1054     +1054     
Flag Coverage Δ
UnitTests 85.98% <95.55%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
web3 ∅ <ø> (∅)
web3-core ∅ <ø> (∅)
web3-errors ∅ <ø> (∅)
web3-eth ∅ <ø> (∅)
web3-eth-abi ∅ <ø> (∅)
web3-eth-accounts ∅ <ø> (∅)
web3-eth-contract ∅ <ø> (∅)
web3-eth-ens ∅ <ø> (∅)
web3-eth-iban ∅ <ø> (∅)
web3-eth-personal ∅ <ø> (∅)
web3-net ∅ <ø> (∅)
web3-providers-http ∅ <ø> (∅)
web3-providers-ipc ∅ <ø> (∅)
web3-providers-ws ∅ <ø> (∅)
web3-rpc-methods ∅ <ø> (∅)
web3-utils ∅ <ø> (∅)
web3-validator ∅ <ø> (∅)

Comment on lines +7 to +9
src/common/chains/**
src/common/eips/**
src/common/hardforks/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring all converted json files for eslint errors as we want no to minimum changes for now in these files ( for avoiding any breaking functionality and easy maintenance of these in near future by updating these json with released eth/comon json files)

@spacesailor24
Copy link
Contributor

Changes to packages/web3-eth-accounts/src/common/common.ts needs to account for the Buffer removal from #6033

@luu-alex
Copy link
Contributor

luu-alex commented May 4, 2023

LGTM, just need to fix conflicts and remove the usage of buffer. think this will be fix after fixing conflicts

@jdevcs
Copy link
Contributor Author

jdevcs commented May 5, 2023

some tests in geth http are failing, and will be fixed under #6060

@jdevcs jdevcs merged commit d4b4b8b into 4.x May 5, 2023
@jdevcs jdevcs deleted the junaid/esmimportfix4x branch May 5, 2023 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants