UNPKG

@nxworker/workspace

Version:

Nx plugin providing generators for managing workspace files, including the move-file generator for safely moving files between projects while updating all imports

23 lines (22 loc) 734 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "stripFileExtension", { enumerable: true, get: function() { return stripFileExtension; } }); const _nodepath = require("node:path"); const _fileextensions = require("../constants/file-extensions"); function stripFileExtension(importPath) { // Only strip .ts, .tsx, .js, .jsx extensions // Preserve .mjs, .mts, .cjs, .cts as they are required for ESM const ext = _nodepath.posix.extname(importPath); if (_fileextensions.strippableExtensions.includes(ext)) { return importPath.slice(0, -ext.length); } return importPath; } //# sourceMappingURL=strip-file-extension.js.map