(
node: ts.SourceFile,
outputState: JSXOutputState,
transformContext: ts.TransformationContext,
)
| 1121 | } |
| 1122 | |
| 1123 | private injectDeclarations( |
| 1124 | node: ts.SourceFile, |
| 1125 | outputState: JSXOutputState, |
| 1126 | transformContext: ts.TransformationContext, |
| 1127 | ): ts.SourceFile { |
| 1128 | const requireCall = transformContext.factory.createCallExpression( |
| 1129 | transformContext.factory.createIdentifier('require'), |
| 1130 | undefined, |
| 1131 | [createStringLiteral(rendererModulePath, transformContext)], |
| 1132 | ); |
| 1133 | const accessToJsx = transformContext.factory.createPropertyAccessExpression(requireCall, 'jsx'); |
| 1134 | |
| 1135 | const rendererVariableStatement = this.createConstVariable('__Renderer', accessToJsx, transformContext); |
| 1136 | outputState.nodePrototypeDeclarations.splice(0, 0, rendererVariableStatement); |
| 1137 | |
| 1138 | const allStatements: ts.Statement[] = []; |
| 1139 | |
| 1140 | const insertionIndex = this.findDeclarationsInsertionIndex(node.statements); |
| 1141 | |
| 1142 | for (const oldStatement of node.statements) { |
| 1143 | allStatements.push(oldStatement); |
| 1144 | } |
| 1145 | |
| 1146 | allStatements.splice(insertionIndex, 0, ...outputState.nodePrototypeDeclarations); |
| 1147 | |
| 1148 | return this.doUpdateSourceFileNode(node, allStatements, transformContext); |
| 1149 | } |
| 1150 | |
| 1151 | private processJSXElement( |
| 1152 | node: ts.JsxElement, |
no test coverage detected