-
Notifications
You must be signed in to change notification settings - Fork 382
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
refactor(macro): split js and react macro into two packages #1883
refactor(macro): split js and react macro into two packages #1883
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #1883 +/- ##
==========================================
- Coverage 77.24% 76.95% -0.29%
==========================================
Files 83 83
Lines 2153 2144 -9
Branches 555 554 -1
==========================================
- Hits 1663 1650 -13
- Misses 379 383 +4
Partials 111 111 ☔ View full report in Codecov by Sentry. |
Thought about packages layout during weekend, and come up with that proposition:
That layout will make this changes less breaking for users and give them enough time to smoothly transition. Both What do you think? |
Looks ok to me. But previously you mentioned that re-exporting is not so good idea:
|
Yes, it's not a good idea, but for the transition period it could be re-exported. What i really don't want, to make a coupling between |
@andrii-bodnar that wouldn't be a breaking change after i implement what i proposed. |
1b68a44
to
795a85a
Compare
@andrii-bodnar any ideas how to update docs? Option 1.
Option2Left @lingui/macro page as is, but instead rename it to something like "Macro Reference", add additional blocks describing what package to use to import Your options? |
@thekip I was thinking about something like this:
The "Macro Reference" might have its own page as well with some general description. |
The PR is ready to review. I think updating docs better to implement in next PR, since this one is already have 122 files changed |
I think codecov just messing up again, this branch hasn't added any new code which is not covered by tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of changes, luckily not too disturbing. 👍
}, | ||
"exports": { | ||
".": { | ||
"require": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may (but prob not) require a bit of extra setup in RN. Please treat this as a note to myself, I'll document it in the RN guide if needed.
edit: this really should just work
Description (edited)
Related RFC: #1361
Split to core (@lingui/core/macro) and react macro (@lingui/react/macro).
And
@lingui/macro
which re-exports@lingui/core/macro
and@lingui/react/macro
for backward compatibility. (will be marked as deprecated and would be removed in lingui@7)Despite an original idea where I wanted to re-export core macro from react, I rejected this because quickly understand that core macro code should be aware of all "re-export" packages so adding macro for Vue, for example, which also re-export core would require adding knowledge of this package to the core.
After this PR typical usage would look like:
Or with only one import, thanks to
useLingui
hook:This PR also extract the actual transformation code into separate babel plugin which could be used without
babel-plugin-macros
:@lingui/babel-plugin-lingui-macro
Next Steps:
@lingui/babel-plugin-lingui-macro
and integrate / link it into macro articlesTypes of changes
Fixes # (issue)
Checklist