(node)
| 305 | dependencies.push(node.arguments[0].value) |
| 306 | }, |
| 307 | ImportDeclaration(node) { |
| 308 | dependencies.push(node.source.value) |
| 309 | let req = "require(" + node.source.raw + ")", text |
| 310 | if (node.specifiers.length == 0) { |
| 311 | text = req |
| 312 | } else if (node.specifiers.length > 1 || node.specifiers[0].type == "ImportDefaultSpecifier") { |
| 313 | let name = "m_" + node.source.value.replace(/\W+/g, "_") + "__" |
| 314 | text = "var " + name + " = " + req |
| 315 | node.specifiers.forEach(spec => { |
| 316 | if (spec.type == "ImportDefaultSpecifier") |
| 317 | text += ", " + spec.local.name + " = " + name + ".default || " + name |
| 318 | else if (name != null) |
| 319 | text += ", " + spec.local.name + " = " + name + "." + spec.imported.name |
| 320 | }) |
| 321 | } else { |
| 322 | text = "var " |
| 323 | node.specifiers.forEach(spec => { |
| 324 | if (spec.type == "ImportNamespaceSpecifier") |
| 325 | text += spec.local.name + " = " + req |
| 326 | else |
| 327 | text += spec.local.name + " = " + req + "." + spec.imported.name |
| 328 | }) |
| 329 | } |
| 330 | patches.push({from: node.start, to: node.end, text: text + ";"}) |
| 331 | }, |
| 332 | ExportNamedDeclaration(node) { |
| 333 | if (node.source || !node.declaration) |
| 334 | patches.push({from: node.start, to: node.end, text: ""}) |
nothing calls this directly
no outgoing calls
no test coverage detected