typescript-transform-paths
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -5,2 +5,9 @@ # Changelog | ||
### [2.2.3](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.2.2...v2.2.3) (2021-02-02) | ||
### Bug Fixes | ||
* Prevent `.json` extension being stripped in output (fixes [#95](https://github.com/LeDDGroup/typescript-transform-paths/issues/95)) ([bcca436](https://github.com/LeDDGroup/typescript-transform-paths/commit/bcca43677d23ddea0a409ec3daff008313d17342)) | ||
### [2.2.2](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.2.1...v2.2.2) (2021-01-11) | ||
@@ -7,0 +14,0 @@ |
@@ -24,10 +24,9 @@ "use strict"; | ||
let res = [".ts", ".d.ts"]; | ||
let { allowJs, jsx, resolveJsonModule: allowJson } = options; | ||
const allowJsx = !!jsx && jsx !== typescript_1.default.JsxEmit.None; | ||
allowJs && res.push(".js"); | ||
let { allowJs, jsx } = options; | ||
const allowJsx = !!jsx && (jsx !== typescript_1.default.JsxEmit.None); | ||
allowJs && res.push(".js", ".cjs", ".mjs"); | ||
allowJsx && res.push(".tsx"); | ||
allowJs && allowJsx && res.push(".jsx"); | ||
allowJson && res.push(".json"); | ||
return res; | ||
} | ||
exports.getImplicitExtensions = getImplicitExtensions; |
@@ -12,3 +12,3 @@ "use strict"; | ||
/* ****************************************************************************************************************** */ | ||
const explicitExtensions = [".js", ".jsx"]; | ||
const explicitExtensions = [".js", ".jsx", ".cjs", ".mjs"]; | ||
// endregion | ||
@@ -93,6 +93,6 @@ /* ****************************************************************************************************************** */ | ||
if (extension && implicitExtensions.includes(extension)) | ||
filePath = filePath.slice(0, -extension.length) + maybeGetExplicitJsExtension(filePath, extension); | ||
filePath = filePath.slice(0, -extension.length) + maybeGetExplicitExtension(filePath, extension); | ||
return filePath[0] === "." || general_utils_1.isURL(filePath) ? filePath : `./${filePath}`; | ||
} | ||
function maybeGetExplicitJsExtension(filePath, resolvedExtension) { | ||
function maybeGetExplicitExtension(filePath, resolvedExtension) { | ||
const moduleExtension = path_1.default.extname(moduleName); | ||
@@ -99,0 +99,0 @@ if (moduleExtension && !explicitExtensions.includes(moduleExtension)) |
{ | ||
"name": "typescript-transform-paths", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Transforms module resolution paths using TypeScript path mapping", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -121,3 +121,2 @@ # typescript-transform-paths | ||
"transform": "typescript-transform-paths", | ||
"useRootDirs": true, | ||
"exclude": [ "**/node_modules/**" ] | ||
@@ -155,3 +154,3 @@ } | ||
- [Node Consumable Modules With Typescript Paths](https://medium.com/@ole.ersoy/node-consumable-modules-with-typescript-paths-ed88a5f332fa?postPublishedType=initial) by [oleersoy](https://github.com/oleersoy") | ||
- [Node Consumable Modules With Typescript Paths](https://medium.com/@ole.ersoy/node-consumable-modules-with-typescript-paths-ed88a5f332fa?postPublishedType=initial) by [oleersoy](https://github.com/oleersoy) | ||
@@ -158,0 +157,0 @@ ## Project Guidelines for Contributors |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51879
504
211