feat(message-utils): separate browser/node exports for generateMessageId#2401
Conversation
|
@yslpn is attempting to deploy a commit to the Crowdin Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2401 +/- ##
==========================================
- Coverage 77.05% 76.70% -0.35%
==========================================
Files 84 102 +18
Lines 2157 2752 +595
Branches 555 720 +165
==========================================
+ Hits 1662 2111 +449
- Misses 382 513 +131
- Partials 113 128 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
timofei-iatsenko
left a comment
There was a problem hiding this comment.
LGTM, except of the bumped dep. Thanks for the contribution!
|
@Zxilly fyi |
|
By the way, what is the use case for generateMessageId in a browser? I couldn't find any information. |
|
My initial idea was to create a faster |
|
@Zxilly what in particulare you would like to customize in it? Maybe that could be solved somehow else. @yslpn it is not used directly in the lingui code, but used by the external integrations. One of the potential use-cases - when you download raw, non-compiled catalogs from the TMS (OTA delivery) and then you need to prepare them to be usable in app. Another use-case which i am aware of, Vue integration which doesn't use compile time macro which is replacing source message with an id, but instead it generate message id at runtime (in a browser). |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Description
Split
generateMessageIdinto separate browser (default) and Node.js implementations:sha256.array()directly instead of hex string conversioncrypto.createHash().digest('base64')Node.js
cryptois faster and doesn't requirejs-sha256dependency. Browser version optimized by avoiding hex parsing. Other runtimes (Deno, Bun, edge workers) support Node.js exports and should work out of the box.Types of changes
Fixes #2381
Checklist