Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
return t.callExpression(
t.identifier(opts.pragmaFragmentVNode || 'createFragment'),
createFragmentVNodeArgs(
vChildren,
childFlags,
vProps.key,
defineAll
)
);
}
// NormalizeProps will normalizeChildren too
if (vProps.needsNormalization) {
fileState.set('normalizeProps', true);
createVNodeCall = t.callExpression(
t.identifier(opts.pragmaNormalizeProps || 'normalizeProps'),
[createVNodeCall]
);
}
return createVNodeCall;
case 'JSXText':
text = handleWhiteSpace(astNode.value);
if (text !== '') {
return t.StringLiteral(text);
}
break;
case 'JSXExpressionContainer':
var expression = astNode.expression;
}
configObject.properties.push(
types.objectProperty(types.identifier('_config'), types.objectExpression(configProperties))
);
return types.callExpression(types.identifier('story'), [node]);
}
if (exportsObject) {
node.properties.push(
types.objectProperty(types.identifier('_config'), types.objectExpression(configProperties))
);
// wrap exported object with `story()`
return types.callExpression(types.identifier('story'), [node]);
}
};
vChildren = transformTextNodes(vChildren, childrenResults, opts, fileState);
}
if (vProps.childFlags) {
// If $ChildFlag is provided it is runtime dependant
childFlags = vProps.childFlags;
} else {
childFlags = vNodeType !== TYPE_COMPONENT && childrenResults.requiresNormalization && !vProps.childrenKnown ? ChildFlags.UnknownChildren : childFlags;
}
var createVNodeCall;
switch (vNodeType) {
case TYPE_COMPONENT:
fileState.set('createComponentVNode', true);
createVNodeCall = t.callExpression(
t.identifier(opts.pragmaCreateComponentVNode || 'createComponentVNode'),
createComponentVNodeArgs(
vProps.flagsOverride || flags,
vType.type,
props,
vProps.key,
vProps.ref,
defineAll
)
);
break;
case TYPE_ELEMENT:
fileState.set('createVNode', true);
createVNodeCall = t.callExpression(
t.identifier(opts.pragma || 'createVNode'),
createVNodeArgs(
options.pre(state, file);
}
const attribs = buildCreateElementOpeningElementAttributes(
path,
openingPath.node.attributes,
);
args.push(attribs, ...path.node.children);
if (options.post) {
options.post(state, file);
}
const call =
state.call || t.callExpression(state.createElementCallee, args);
if (state.pure) annotateAsPure(call);
return call;
}
} else {
const mergeResult = getMergeValueExpression({
attrPath,
stateBindingStack,
newValExpression,
prevState,
useType: 'hook'
});
statements = mergeResult.statements;
result = mergeResult.result;
}
return [
...statements,
t.expressionStatement(
t.callExpression(
updateFn,
[result]
)
)
];
}
const {
statements,
result
} = getMergeValueExpression({
attrPath,
stateBindingStack,
newValExpression,
prevState: prevStateVar,
useType: 'class'
});
return [
t.expressionStatement(
t.callExpression(
builder.buildMemberExpression(
t.thisExpression(),
t.identifier('setState')
),
[
t.arrowFunctionExpression(
[prevStateVar],
t.blockStatement([
...statements,
t.returnStatement(result)
])
)
]
)
)
];
const dynamicExpressionInitComputeValues = (expression, fComputeParameters) => {
return t.callExpression(t.memberExpression(t.identifier("fidan"), t.identifier("initCompute")), [
t.functionExpression(t.identifier(""), [], t.blockStatement([t.returnStatement(expression)]))
].concat(fComputeParameters));
};
const fidanAssignmentExpressionSetCompute = (expression, fComputeParameters) => {
execute: ({ ast }) => {
const expressionPath = path.slice().reverse();
getNodeFromPath(ast, expressionPath.slice(0, -1))[
expressionPath[expressionPath.length - 1]
] = t.callExpression(t.identifier('call'), [node]);
return ast =>
selectName(
getNodeFromPath(ast, expressionPath.concat('callee'))
);
}
}
_serializeConsoleLog(
{ }: OperationDescriptorData,
[propName, ...nodes]: Array
): BabelNodeStatement {
let propString = ((propName: any): BabelNodeStringLiteral).value;
return t.expressionStatement(
t.callExpression(t.memberExpression(t.identifier("console"), t.identifier(propString)), [...nodes])
);
}