(exec_path)
| 20 | } |
| 21 | }, |
| 22 | isESModule(exec_path) { |
| 23 | var fs = require('fs') |
| 24 | var path = require('path') |
| 25 | var data |
| 26 | |
| 27 | var findPackageJson = function(directory) { |
| 28 | var file = path.join(directory, 'package.json') |
| 29 | if (fs.existsSync(file) && fs.statSync(file).isFile()) { |
| 30 | return file; |
| 31 | } |
| 32 | var parent = path.resolve(directory, '..') |
| 33 | if (parent === directory) { |
| 34 | return null; |
| 35 | } |
| 36 | return findPackageJson(parent) |
| 37 | } |
| 38 | |
| 39 | if (path.extname(exec_path) === '.mjs') |
| 40 | return true |
| 41 | |
| 42 | try { |
| 43 | data = JSON.parse(fs.readFileSync(findPackageJson(path.dirname(exec_path)))) |
| 44 | if (data.type === 'module') |
| 45 | return true |
| 46 | else |
| 47 | return false |
| 48 | } catch(e) { |
| 49 | } |
| 50 | } |
| 51 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…