react-native/local-cli/util
Rafael Oleza e4621f4ce1 Expose the actual transformer in the config
Summary:
This diff exposes the new more generic way to configure transformers in `Metro` via the config parameter `transformerPath`.

The new generic transformers can be used to transform any kind of file, since they don't call any JS-specific method and their API is generic. They only need to implement a single `transform` method:

```
async function transform(
  absolutePath: string,
  relativePath: string,
  fileContents: Buffer,
  options: TransformOptions, // very soon these will be configurable
): Promise<{
  output: Array<mixed>,
  dependencies: Array<{
    name: string,
    data: mixed, // very soon
  }>,
}> {
  // ...
}
```

Metro already had a `transformModulePath` config param, which was used to configure how babel was called in order to generate the AST. In order to avoid confusion, but keep the current open source transformer worker, I've renamed this param to `babelTransformerPath`. We can add a layer of compatibility and detect old config params in order to show a deprecation warning.

Reviewed By: pvdz

Differential Revision: D9070810

fbshipit-source-id: aebde879736026c09537f5d236eae24c06640abf
2018-08-23 15:48:04 -07:00
..
__mocks__ Move out "genMockFunction" and "genMockFn" to "fn" 2018-05-23 13:40:06 -07:00
__tests__ Update license headers for MIT license 2018-02-16 18:31:53 -08:00
Config.js Expose the actual transformer in the config 2018-08-23 15:48:04 -07:00
PackageManager.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
assertRequiredOptions.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
copyAndReplace.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
findReactNativeScripts.js Flow strictify possible files in RN core 2018-06-20 00:47:21 -07:00
findSymlinkedModules.js Flow strictify possible files in RN core 2018-06-20 00:47:21 -07:00
findSymlinksPaths.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
isPackagerRunning.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
isValidPackageName.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
log.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
parseCommandLine.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
walk.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00
yarn.js Prettier RN local-cli 2018-05-11 13:00:50 -07:00