Skip to content
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

[compiler] Todo for fbt with multiple pronoun/plural #30437

Merged
merged 4 commits into from
Jul 29, 2024

Commits on Jul 23, 2024

  1. [compiler] Todo for fbt with multiple pronoun/plural

    [ghstack-poisoned]
    mofeiZ committed Jul 23, 2024
    Configuration menu
    Copy the full SHA
    1137e75 View commit details
    Browse the repository at this point in the history

Commits on Jul 24, 2024

  1. Update on "[compiler] Todo for fbt with multiple pronoun/plural"

    ---
    
    (pasted from fixture comment)
    The root issue here is that fbt:plural/enum/pronoun read `.start` and `.end` from babel nodes to slice into source strings for some complex dedupe logic (see [_getStringVariationCombinations](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/JSFbtBuilder.js#L297))
    
    Since Forget does not add `.start` and `.end` for babel nodes it synthesizes, [getRawSource](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/FbtUtil.js#L666-L673) simply returns the whole source code string. As a result, all fbt nodes dedupe together and _getStringVariationCombinations ends up early exiting (before adding valid candidate values).
    
    For fbt:plural tags specifically, the `count` node require that a `.start/.end` be attached (see [code in FbtPluralNode](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/fbt-nodes/FbtPluralNode.js#L87-L90)).
    
    
    ---
    For now, let's just bail out :-)
    
    [ghstack-poisoned]
    mofeiZ committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    5991434 View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2024

  1. Update on "[compiler] Todo for fbt with multiple pronoun/plural"

    ---
    
    (pasted from fixture comment)
    The root issue here is that fbt:plural/enum/pronoun read `.start` and `.end` from babel nodes to slice into source strings for some complex dedupe logic (see [_getStringVariationCombinations](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/JSFbtBuilder.js#L297))
    
    Since Forget does not add `.start` and `.end` for babel nodes it synthesizes, [getRawSource](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/FbtUtil.js#L666-L673) simply returns the whole source code string. As a result, all fbt nodes dedupe together and _getStringVariationCombinations ends up early exiting (before adding valid candidate values).
    
    For fbt:plural tags specifically, the `count` node require that a `.start/.end` be attached (see [code in FbtPluralNode](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/fbt-nodes/FbtPluralNode.js#L87-L90)).
    
    
    ---
    For now, let's just bail out :-)
    
    [ghstack-poisoned]
    mofeiZ committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    cc80ec7 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Update on "[compiler] Todo for fbt with multiple pronoun/plural"

    ---
    
    (pasted from fixture comment)
    The root issue here is that fbt:plural/enum/pronoun read `.start` and `.end` from babel nodes to slice into source strings for some complex dedupe logic (see [_getStringVariationCombinations](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/JSFbtBuilder.js#L297))
    
    Since Forget does not add `.start` and `.end` for babel nodes it synthesizes, [getRawSource](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/FbtUtil.js#L666-L673) simply returns the whole source code string. As a result, all fbt nodes dedupe together and _getStringVariationCombinations ends up early exiting (before adding valid candidate values).
    
    For fbt:plural tags specifically, the `count` node require that a `.start/.end` be attached (see [code in FbtPluralNode](https://github.com/facebook/fbt/blob/main/packages/babel-plugin-fbt/src/fbt-nodes/FbtPluralNode.js#L87-L90)).
    
    
    ---
    For now, let's just bail out :-)
    
    [ghstack-poisoned]
    mofeiZ committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    4e69352 View commit details
    Browse the repository at this point in the history