(file)
| 118051 | } |
| 118052 | } |
| 118053 | function collectDynamicImportOrRequireCalls(file) { |
| 118054 | var r = /import|require/g; |
| 118055 | while (r.exec(file.text) !== null) { // eslint-disable-line no-null/no-null |
| 118056 | var node = getNodeAtPosition(file, r.lastIndex); |
| 118057 | if (isJavaScriptFile && ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) { |
| 118058 | ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here |
| 118059 | imports = ts.append(imports, node.arguments[0]); |
| 118060 | } |
| 118061 | // we have to check the argument list has length of at least 1. We will still have to process these even though we have parsing error. |
| 118062 | else if (ts.isImportCall(node) && node.arguments.length >= 1 && ts.isStringLiteralLike(node.arguments[0])) { |
| 118063 | ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here |
| 118064 | imports = ts.append(imports, node.arguments[0]); |
| 118065 | } |
| 118066 | else if (ts.isLiteralImportTypeNode(node)) { |
| 118067 | ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here |
| 118068 | imports = ts.append(imports, node.argument.literal); |
| 118069 | } |
| 118070 | } |
| 118071 | } |
| 118072 | /** Returns a token if position is in [start-of-leading-trivia, end), includes JSDoc only in JS files */ |
| 118073 | function getNodeAtPosition(sourceFile, position) { |
| 118074 | var current = sourceFile; |
no test coverage detected