MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / resolveModulePath

Method resolveModulePath

packages/cli/src/CLIHelper.ts:277–288  ·  view source on GitHub ↗

* Resolve path to a module. * @param id The module to require * @param [from] Location to start the node resolution

(id: string, from = process.cwd())

Source from the content-addressed store, hash-verified

275 * @param [from] Location to start the node resolution
276 */
277 private static resolveModulePath(id: string, from = process.cwd()): string {
278 if (!extname(from)) {
279 from = join(from, '__fake.js');
280 }
281
282 const path = fs.normalizePath(import.meta.resolve(id, pathToFileURL(from)));
283 const parts = path.split('/');
284 const idx = parts.lastIndexOf(id) + 1;
285 parts.splice(idx, parts.length - idx);
286
287 return parts.join('/');
288 }
289
290 static dumpTable(options: { columns: string[]; rows: string[][]; empty: string }): void {
291 if (options.rows.length === 0) {

Callers 1

getModuleVersionMethod · 0.95

Calls 2

normalizePathMethod · 0.80
joinMethod · 0.65

Tested by

no test coverage detected