Skip to content

Conversation

@cyfung1031
Copy link

@cyfung1031 cyfung1031 commented Jan 13, 2024

I noticed that there are many compatibile codes but they are useless nowadays since all browsers are supporting those features, no polyfill is required.

To further minimize the node, there should be a md5-lite.min.js output file if you still want to keep the polyfills in the original version. Also, I am doubt about the hmac necessity. It seems no use to have hmac so that this is not included in md5-lite as well.

there are full.config.js and lite.config.js in src/config such that when uglifyjs run the compression, it can remove the polyfill in the lite version and keep them in the full version.

I have also updated the related testing such that the coverage report can reach 100%, by including the options for lite version.

To summary, lite version excludes md5.hmac and can run in all modern environments including Node 10+, Worker, Edge, Chrome, Firefox, Safari, except IE.

There are also some minor changes:

  • Update uglify-js from 3.1.9 to 3.17.4
  • In addition to compress and build, there are compress-lite (md5.lite.js) and build-bun (use bun instead of node to build)
  • Added dist-src and dist-lite to for the output file in pretty format (they can be deleted or moved to testing output)
  • Changed to node_modules script link in testing html pages to CDN links
  • Changed Worker detection to WorkerGlobalScope

File Size Reduction

  • md5.min.js (0.8.3): 10 KB
  • md5.min.js (0.9.0): 9 KB
  • md5-lite.min.js: 8 KB

@emn178
Copy link
Owner

emn178 commented Jan 24, 2024

Thank you for PR, I will review this when I have time.

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.

2 participants