[Snyk] Upgrade fluent from 0.6.4 to 0.12.0 #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to upgrade
fluent
from 0.6.4 to 0.12.0.Release notes
Flatten complex reference expressions. (#221)
Reference expressions which may take complex forms, such as a reference
to a message's attribute, or a parameterized reference to an attribute of
a term, are now stored in a simplified manner. Instead of nesting
multiple expression nodes (e.g.
CallExpression
of anAttributeExpression
of aTermReference
), all information is availabledirectly in the reference expression.
This change affects the following AST nodes:
MessageReference
now has an optionalattribute
field,FunctionReference
now has a requiredarguments
field,TermReference
now has an optionalattribute
field and an optionalarguments
field.Remove
VariantLists
. (#204)The
VariantLists
and theVariantExpression
syntax and AST nodes weredeprecated in Syntax 0.9 and have now been removed.
Rename
StringLiteral.raw
tovalue
. (#243)StringLiteral.value
contains the exact contents of the string literal,character-for-character. Escape sequences are stored verbatim without
processing.
Implementations may decide how to process the raw value. When they do,
however, they must comply with the behavior specified in
Literal.parse
.Rename
args
toarguments
.The
args
field ofMessageReference
,TermReference
,FunctionReference
, andAnnotation
has been renamed toarguments
.Preserve content-indent in multiline
Patterns
. (#162)Multiline
Patterns
require to be indented by at least one space. InSyntax 0.7 all leading ident of every line was stripped. In Syntax 0.8
only the maximum indent common to all indented lines is removed. This
behavior works for all
Patterns
: inMessages
,Terms
,Attributes
and
Variants
.multiline1 = This message has two spaces of indent on the second line of its value.
This behavior also works when the first line of a block
Pattern
isindented relative to the following lines:
multiline2 = This message has two spaces of indent on the first line of its value.
Note that only indented lines participate in this behavior. Specifically,
if a
Pattern
starts on the same line as the message identifier, thenit's not considered as indented, and is excluded from the indent
stripping.
multiline3 = This message has two spaces of indent on the second line of its value. The first line is not considered indented at all.
If a
Pattern
starts on the same line as the identifier, its first lineis subject to the leading-whitespace stripping which is applied to all
Patterns
.Note that if a multiline
Pattern
starts on the same line as theidentifier and it only consists of one more line of text below it, then
the maximum indent common to all indented lines is equal to the indent
of the second line, i.e. the only indented line. All indent will be
removed in this case.
{" "}
can be used to preserve it explicitly.multiline5 = This message has no indent on the second line of its value.
Deprecate
VariantLists
. (#204)VariantLists
andVariantExpression
have been deprecated. They will beremoved before Fluent 1.0 is released. Please use parameterized
Terms
instead (see below). Furthermore, in Syntax 0.8 it's not possible to nest
VariantLists
anymore (#220).Introduce parameterized
Terms
. (#176, #212)References to
Terms
can now receive parameters which will be used bythe runtime as values of variables referenced from within the
Term
.This allows
Terms
to use regularPatterns
as values, rather thanVariantLists
:Since
Patterns
can be nested, this feature allows more complexhierarchies of term values:
Parameters must be named; positional parameters are ignored. If a
parameter is omitted then the regular default variant logic applies. The
above example could thus be written as
{-term(article: "indefinite")}
and the
lower
variant would be used because it is marked as the defaultone. If no parameters are specified, the paranthesis can be omitted:
{-term()}
and{-term}
are functionally the same.Term attributes can be parameterized as well. To access them, use the
-term.attr(param: "value")
syntax.Support all Unicode characters in values. 🎉 (#174, #207)
All Unicode characters can now be used in values of
TextElements
andStringLiterals
, except those recognized as special by the syntax. Referto
spec/recommendations.md
for information about character ranges whichtranslation authors are encouraged to avoid.
Don't store the
-
sigil inIdentifiers
ofTerms
. (#142)The
-
sigil is no longer part of the term'sIdentifier
. This is nowconsistent with how
Identifiers
of variables don't include the$
sigil either.
Treat backslash (
\
) as a regular character inTextElements
. (#123)Backslash does no longer have special escaping powers when used in
TextElements
. It's still recognized as special inStringLiterals
,however.
StringLiterals
can be used to insert all special-purposecharacters in text. For instance,
{"{"}
will insert the literal openingcurly brace (
{
),{"\u00A0"}
will insert the non-breaking space, and{" "}
can be used to make a translation start or end with whitespace,which would otherwise by trimmed by
Pattern.
Forbid closing brace in
TextElements
. (#186)Both the opening and the closing brace are now considered special when
present in
TextElements
.{"}"}
can be used to insert a literalclosing brace.
Store both the raw and the unescaped value in
StringLiteral
. (#203)StringLiteral.value
has been change to store the unescaped ("cooked")value of the string literal: all known escape sequences are replaced with
the characters they represent.
StringLiteral.raw
has been added andstores the raw value as it was typed by the author of the string literal:
escapes sequences are not processed in any way.
Add the
\UHHHHHH
escape sequence. (#201)In addition to the already-supported
\uHHHH
escape sequence,\UHHHHHH
is now also recognized and can be used to encode Unicode codepoints in the
U+010000 to U+10FFFF range. For example,
{"\U01F602"}
can be used torepresent 😂.
Don't normalize line endings in
Junk
. (#184)Junk represents a literal slice of unparsed content and shouldn't have
its line endings normalized to LF.
Add the
FunctionReference
production. (#210)Function references in
CallExpressions
are now stored asFunctionReference
AST nodes, with anid
field which is anIdentifier
.The
Function
production and its corresponding AST node have beenremoved. The logic validating that function names are all upper-case has
been moved to
abstract.mjs
.Relax the indentation requirement. (#87)
Attributes, variant keys and placeables may now be written without
indent, including the closing curly brace,
}
.Multiline
TextElements
still require indent to aid error recovery.Forbid tab as syntax whitespace. (#165)
Tabs are now parsed as part of
TextElement
's value and are not allowedoutside of them.
Remove support for CR as a line ending. (#154)
Valid line endings for Fluent files are: LF (U+0A) and CRLF (U+0D U+0A).
Normalize all EOLs as LF. (#163)
The AST now stores line endings using the line feed character (LF, U+0A),
even if the input file used CRLF or a mix of CRLF and LF.
Restrict
VariantKey
toNumberLiteral
andIdentifier
. (#127)The
VariantName
AST node has been removed🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs