14 lines
329 B
JavaScript
14 lines
329 B
JavaScript
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
/**
|
|
* @param {string} url
|
|
*/
|
|
export function getModulePaths(url) {
|
|
const pathname = fileURLToPath(url);
|
|
const parts = pathname.split("/");
|
|
const basename = parts.pop();
|
|
const dirname = parts.join(path.sep);
|
|
return { pathname, dirname, basename };
|
|
}
|