Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* This is a React Native only transform that runs after the fbt syntax
* transform. It extracts jsfbt and strip out extra information from the payload
* produced by the fbt syntax transform.
*
* @format
*/
'use strict';
/* eslint consistent-return: 0 */
/* eslint max-len: ["warn", 120] */
/* jslint node: true */
const {fbtHashKey: jenkinsHashKey} = require('babel-plugin-fbt');
const {shiftEnumsToTop} = require('babel-plugin-fbt').FbtShiftEnums;
const invariant = require('fbjs/lib/invariant');
let fbtHashKey = jenkinsHashKey;
module.exports = function fbtRuntime(babel) {
const t = babel.types;
function _buildEnumToHashKeyObjectExpression(curLevel, desc, enumsLeft) {
const properties = [];
for (const enumKey in curLevel) {
properties.push(
t.objectProperty(
t.identifier(enumKey),
enumsLeft === 1
? t.stringLiteral(fbtHashKey(curLevel[enumKey], desc))
: _buildEnumToHashKeyObjectExpression(