Comparing version 1.6.9 to 1.6.10
@@ -6,2 +6,11 @@ "use strict"; | ||
const utils_1 = require("../utils"); | ||
function escapeSpecialChars(str) { | ||
return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | ||
} | ||
function getAliasPrefixRegExp(alias) { | ||
return new RegExp(`(?:^${escapeSpecialChars(alias.prefix)})|(?:\.(js|json)$)`, 'g'); | ||
} | ||
function removeAliasPrefix(requiredModule, alias) { | ||
return requiredModule.replace(getAliasPrefixRegExp(alias), ''); | ||
} | ||
function replaceImportStatement({ orig, file, config }) { | ||
@@ -25,3 +34,3 @@ var _a, _b; | ||
? normalizePath(absoluteAliasPath) | ||
: normalizePath(`${absoluteAliasPath}/${requiredModule.replace(new RegExp(`(?:^${alias.prefix.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')})|(?:\.js$)`, 'g'), '')}`))) { | ||
: normalizePath(`${absoluteAliasPath}/${removeAliasPrefix(requiredModule, alias)}`))) { | ||
continue; | ||
@@ -28,0 +37,0 @@ } |
@@ -17,2 +17,3 @@ "use strict"; | ||
(0, fs_1.existsSync)(`${path}.js`) || | ||
(0, fs_1.existsSync)(`${path}.json`) || | ||
(0, fs_1.existsSync)(`${path}.jsx`) || | ||
@@ -19,0 +20,0 @@ (0, fs_1.existsSync)(`${path}.cjs`) || |
{ | ||
"name": "tsc-alias", | ||
"version": "1.6.9", | ||
"version": "1.6.10", | ||
"description": "Replace alias paths with relative paths after typescript compilation.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
111796
932