* For extensionless files in a `module` package scope, we check the file contents to disambiguate between ES module * JavaScript and Wasm. * We do this by taking advantage of the fact that all Wasm files start with the header `0x00 0x61 0x73 0x6d` (`_asm`). * @param {URL} url * @returns {'wasm'|
(url)
| 58 | * @returns {'wasm'|'module'} |
| 59 | */ |
| 60 | function getFormatOfExtensionlessFile(url) { |
| 61 | const path = getValidatedPath(url); |
| 62 | switch (fsBindings.getFormatOfExtensionlessFile(path)) { |
| 63 | case internalConstants.EXTENSIONLESS_FORMAT_WASM: |
| 64 | return 'wasm'; |
| 65 | default: |
| 66 | return 'module'; |
| 67 | } |
| 68 | } |
| 69 | const { containsModuleSyntax } = internalBinding('contextify'); |
| 70 | const { getPackageScopeConfig, getPackageType } = require('internal/modules/package_json_reader'); |
| 71 | const { fileURLToPath } = require('internal/url'); |
no outgoing calls
no test coverage detected
searching dependent graphs…