Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
break
default:
// don't handle anything else
throw new Error(
`createVuePropsDefinition encountered a unknown PropDefinition, ${JSON.stringify(
uidlPropDefinitions[name]
)}`
)
}
let defaultPropValue = null
if (defaultValue !== undefined) {
defaultPropValue =
type === 'array' || type === 'object'
? new ParsedASTNode(
t.arrowFunctionExpression([], ASTUtils.convertValueToLiteral(defaultValue))
)
: defaultValue
}
acc[name] = defaultPropValue ? { type: mappedType, default: defaultPropValue } : mappedType
acc[name] = isRequired ? { required: isRequired, ...acc[name] } : acc[name]
return acc
}, {})
}
(acc: any, key) => {
const { type, isRequired } = propDefinitions[key]
const astProp = t.memberExpression(t.identifier(propTypesNames), t.identifier(type))
const astValue = isRequired
? t.memberExpression(astProp, t.identifier('isRequired'))
: astProp
acc.values[key] = new ParsedASTNode(astValue)
acc.count++
return acc
},
{ values: {}, count: 0 }
jssStyleMap[className] = UIDLUtils.transformDynamicStyles(style, (styleValue) => {
if (styleValue.content.referenceType === 'prop') {
return new ParsedASTNode(
ASTBuilders.createArrowFunctionWithMemberExpression('props', styleValue.content.id)
)
}
throw new Error(
`Error running transformDynamicStyles in reactJSSComponentStyleChunksPlugin. Unsupported styleValue.content.referenceType value ${styleValue.content.referenceType}`
)
})
ASTUtils.addDynamicAttributeToJSXTag(