formatjs / formatjs

The monorepo home to all of the FormatJS related libraries, most notably react-intl.

Home Page:https://formatjs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cli-lib: onMsgExtracted never gets called

adbl opened this issue · comments

Which package?

cli-lib

Describe the bug

Setting the option onMsgExtracted has no effect when using extract from @formatjs/cli-lib, the callback never gets called because that option gets overridden here:

onMsgExtracted(_, msgs) {

To Reproduce

Codesandbox URL

n/a

Reproducible Steps/Repo

  1. Run a script like:
import { extract } from "@formatjs/cli-lib";
import { DEFAULT_ID_INTERPOLATION_PATTERN } from "babel-plugin-formatjs";

await extract(<files>, {
  extractSourceLocation: true,
  // needed for some reason
  idInterpolationPattern: DEFAULT_ID_INTERPOLATION_PATTERN,
  throws: true,
      
  // doesn't get called 🤥
  onMsgExtracted: (...args) => {
    console.log("onMsgExtracted");
  },
});
  1. Observe that onMsgExtracted doesn't get printed.

Expected behavior

onMsgExtracted should be printed on the console.

Desktop (please complete the following information):

n/a

Smartphone (please complete the following information):

n/a

Additional context

Nothing I can think of.

PR upcoming...