@wroud/di-tools-codemod
Version:
@wroud/di-tools-codemod is a codemod utility that automates the migration of your codebase from Inversify to @wroud/di. It streamlines the transformation process, allowing for effortless and customizable transitions through configuration support.
23 lines (22 loc) • 852 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getModulePath = getModulePath;
const node_path_1 = __importDefault(require("node:path"));
function getModulePath(file, transformerOptions) {
const pathWithoutExtension = node_path_1.default.join(file.path.replace(/\.[^/.]+$/, ""));
const ext = node_path_1.default.extname(file.path);
if (transformerOptions.esm) {
switch (ext) {
case ".ts":
return `${pathWithoutExtension}.js`;
case ".tsx":
return `${pathWithoutExtension}.jsx`;
default:
return pathWithoutExtension + ext;
}
}
return pathWithoutExtension;
}
;