* @param {string} currentDirectory current directory * @param {string | string[]} module module * @returns {ModuleInfo | undefined} module info
(currentDirectory, module)
| 361 | * @returns {ModuleInfo | undefined} module info |
| 362 | */ |
| 363 | _resolveModule(currentDirectory, module) { |
| 364 | if (Array.isArray(module)) { |
| 365 | return { |
| 366 | origin: /** @type {string} */ (/** @type {EXPECTED_ANY} */ (module)), |
| 367 | subPath: "", |
| 368 | modulePath: path.join(currentDirectory, ".array-require.js"), |
| 369 | content: `module.exports = (${module |
| 370 | .map((arg) => `require(${JSON.stringify(`./${arg}`)})`) |
| 371 | .join(", ")});` |
| 372 | }; |
| 373 | } |
| 374 | if (isRelativePath(module)) { |
| 375 | return { |
| 376 | origin: module, |
| 377 | subPath: getSubPath(module), |
| 378 | modulePath: path.join(currentDirectory, module), |
| 379 | content: fs.readFileSync(path.join(currentDirectory, module), "utf8") |
| 380 | }; |
| 381 | } |
| 382 | if (path.isAbsolute(module)) { |
| 383 | return { |
| 384 | origin: module, |
| 385 | subPath: "", |
| 386 | modulePath: module, |
| 387 | content: fs.readFileSync(module, "utf8") |
| 388 | }; |
| 389 | } |
| 390 | if (module.startsWith("https://test.")) { |
| 391 | const realPath = urlToPath(module, currentDirectory); |
| 392 | return { |
| 393 | origin: module, |
| 394 | subPath: "", |
| 395 | modulePath: realPath, |
| 396 | content: fs.readFileSync(realPath, "utf8") |
| 397 | }; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * @param {string} currentDirectory current directory |
no test coverage detected