Automattic / i18n-calypso

i18n JavaScript library on top of Jed originally used in Calypso
GNU General Public License v2.0
24 stars 19 forks source link

Consider making Xgettext.parseOptions configurable #51

Open ryerh opened 6 years ago

ryerh commented 6 years ago

Xgettext.parseOptions are hard coded here as following:

parser = new Xgettext( {
    keywords: parserKeywords,
    parseOptions: {
        plugins: [ 
            'jsx',
            'classProperties',
            'objectRestSpread',
            'exportExtensions',
            'trailingFunctionCommas',
            'asyncFunctions',
        ],
        allowImportExportEverywhere: true,
    }
} );

The plugins part is missing some new ES syntax like:

I propose two approach to extend this feature:

  1. Read parseOptions from $PWD/package.json -> i18nCalypso.parseOptions, then merge with default parseOptions
  2. Extend existing parseOptions to keep update with new ES syntax

Any suggestions? I will open a PR after once an approach has been chosen.

Yuyz0112 commented 6 years ago

+1 And xgettext-js has the babylon@6.8.4 dependency, which does not support some plugins like dynamicImport etc.