MCPcopy Create free account
hub / github.com/Snapchat/Valdi / extractJSXAttributes

Method extractJSXAttributes

compiler/companion/src/JSXProcessor.ts:1482–1512  ·  view source on GitHub ↗
(
    node: ts.Node,
    output: JSXOutputState,
    transformContext: ts.TransformationContext,
  )

Source from the content-addressed store, hash-verified

1480 }
1481
1482 private extractJSXAttributes(
1483 node: ts.Node,
1484 output: JSXOutputState,
1485 transformContext: ts.TransformationContext,
1486 ): JSXAttribute[] {
1487 const jsxAttributes: JSXAttribute[] = [];
1488 ts.forEachChild(node, (attribute) => {
1489 switch (attribute.kind) {
1490 case ts.SyntaxKind.JsxAttribute:
1491 {
1492 let jsxAttribute = this.extractJSXAttribute(attribute, output, transformContext);
1493 jsxAttributes.push(jsxAttribute);
1494 }
1495 break;
1496 case ts.SyntaxKind.JsxSpreadAttribute:
1497 {
1498 let jsxAttribute = this.extractJSXSpreadAttribute(attribute);
1499 jsxAttributes.push({
1500 node: attribute,
1501 name: undefined,
1502 value: jsxAttribute,
1503 });
1504 }
1505 break;
1506 default:
1507 this.onUnexpectedNodeKind(node);
1508 }
1509 });
1510
1511 return jsxAttributes;
1512 }
1513
1514 static createFromFile(fileName: string, fileContent: string, includeSourceMapping: boolean): JSXFileProcessor {
1515 return new JSXFileProcessor(fileName, fileContent, includeSourceMapping);

Callers 3

getSlotValueExprMethod · 0.95
processJSXElementMethod · 0.95

Calls 4

extractJSXAttributeMethod · 0.95
onUnexpectedNodeKindMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected