(pjsonPath, url)
| 143 | |
| 144 | let typelessPackageJsonFilesWarnedAbout; |
| 145 | function warnTypelessPackageJsonFile(pjsonPath, url) { |
| 146 | typelessPackageJsonFilesWarnedAbout ??= new SafeSet(); |
| 147 | if (!underNodeModules(url) && !typelessPackageJsonFilesWarnedAbout.has(pjsonPath)) { |
| 148 | const warning = `Module type of ${url} is not specified and it doesn't parse as CommonJS.\n` + |
| 149 | 'Reparsing as ES module because module syntax was detected. This incurs a performance overhead.\n' + |
| 150 | `To eliminate this warning, add "type": "module" to ${pjsonPath}.`; |
| 151 | process.emitWarning(warning, { |
| 152 | code: 'MODULE_TYPELESS_PACKAGE_JSON', |
| 153 | }); |
| 154 | typelessPackageJsonFilesWarnedAbout.add(pjsonPath); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * @param {URL} url |
no test coverage detected
searching dependent graphs…