MCPcopy Index your code
hub / github.com/formatjs/formatjs / getVisitor

Function getVisitor

packages/ts-transformer/transform.ts:934–957  ·  view source on GitHub ↗
(
  ts: TypeScript,
  ctx: typescript.TransformationContext,
  sf: typescript.SourceFile,
  opts: Opts
)

Source from the content-addressed store, hash-verified

932const PRAGMA_REGEX = /^\/\/ @([^\s]*) (.*)$/m
933
934function getVisitor(
935 ts: TypeScript,
936 ctx: typescript.TransformationContext,
937 sf: typescript.SourceFile,
938 opts: Opts
939) {
940 const visitor: typescript.Visitor = (
941 node: typescript.Node
942 ): typescript.Node => {
943 const newNode = ts.isCallExpression(node)
944 ? extractMessagesFromCallExpression(ts, ctx.factory, node, opts, sf)
945 : ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)
946 ? extractMessageFromJsxComponent(
947 ts,
948 ctx.factory,
949 node as typescript.JsxOpeningElement,
950 opts,
951 sf
952 )
953 : node
954 return ts.visitEachChild(newNode as typescript.Node, visitor, ctx)
955 }
956 return visitor
957}
958
959export function transformWithTs(
960 ts: TypeScript,

Callers 1

transformFnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected