-
Notifications
You must be signed in to change notification settings - Fork 156
Update MF2 to match upstream changes #414
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
Conversation
…esolveValue wrappers
…ssageformat/functions/utils
Very happy to see this working going on. I didn't read to the bottom of the code yet. I do notice lots of good general code hygiene in here as well. |
Added CST backreferences to the parsed data model, available as
|
…(src)) instead of asDataModel(parseMessage(src))
Added |
This should bring the implementation to parity with the current spec, pre-emptively also including changes from:
<matchSignature>
for:number
, together with:ordinal
&:plural
aliases unicode-org/message-format-wg#560Some ESLint changes are included, which is why this touches some files outside the
packages/mf2-*
directories. I've also dropped commitlint, as it was getting too annoying during development.The
@messageformat/fluent
package is here made ES-only, as that was the easiest way to satisfy TS regarding its@fluent/syntax
dependency. This may be a temporary thing; we'll see. The Fluent -> MF2 converters now use duck-typing to detect plural selectors; this can be disabled with an option.The XLIFF representation is streamlined a bit. Am considering using
<originalData>
and<res:resourceData>
for some of what's currently in a wholly custom<mf:messageformat>
container.The
messageformat
exports are refactored quite a bit, adding new endpointsmessageformat/functions
andmessageformat/functions/utils
with relevant parts of the API.Two new data model tools are added:
visit
is a specialized message data visitor, andvalidate
checks that the model does not have any data model errors, and reports the function & variable dependencies of a message. Currently it effectively duplicates functionality from the CST parser; that should get resolved at some point, but that'll require a datamodel -> CST mapper so that the errors can still be reported by character position.The JSON test fixtures are refactored a bit, separating out:
The internal file structures of the main package have evolved quite a bit, and feel like they make some sense again. I'm not really expecting anyone to review all the changes here, as that would likely be quite a slog.
CC @aphillips, @mradbourne