Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
upstreamTransformer = require('metro/src/transformer');
} else if (reactNativeMinorVersion >= 0.47) {
upstreamTransformer = require('metro-bundler/src/transformer');
} else if (reactNativeMinorVersion === 0.46) {
upstreamTransformer = require('metro-bundler/build/transformer');
} else {
// handle RN <= 0.45
const oldUpstreamTransformer = require('react-native/packager/transformer');
upstreamTransformer = {
transform({ src, filename, options }) {
return oldUpstreamTransformer.transform(src, filename, options);
},
};
}
const gqlTransform = gqlLoader.bind({
cacheable: () => null,
});
function transform(src, filename, options) {
if (typeof src === 'object') {
// handle RN >= 0.46
({ src, filename, options } = src);
}
// Do custom transformations
let result = src;
if (filename.endsWith('.gql') || filename.endsWith('.graphql')) {
result = gqlTransform(result);
}
const babelCompileResult = upstreamTransformer.transform({