* Determine whether the given ambiguous source contains CommonJS or ES module syntax. * @param {string | Buffer | undefined} [source] * @param {URL} url * @returns {'module'|'commonjs'}
(source, url)
| 85 | * @returns {'module'|'commonjs'} |
| 86 | */ |
| 87 | function detectModuleFormat(source, url) { |
| 88 | const detectModule = getOptionValue('--experimental-detect-module'); |
| 89 | if (!source) { return detectModule ? null : 'commonjs'; } |
| 90 | if (!detectModule) { return 'commonjs'; } |
| 91 | return containsModuleSyntax(`${source}`, fileURLToPath(url), url) ? 'module' : 'commonjs'; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @param {URL} parsed |
no test coverage detected
searching dependent graphs…