typescript-transform-paths
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -5,2 +5,10 @@ # Changelog | ||
### [2.2.1](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.2.0...v2.2.1) (2021-01-10) | ||
### Bug Fixes | ||
* Preserve explicit file extensions (closes [#89](https://github.com/LeDDGroup/typescript-transform-paths/issues/89)) ([b0627f8](https://github.com/LeDDGroup/typescript-transform-paths/commit/b0627f8f6cd49681ff58ffad48e04e96a9e9ba27)) | ||
* Rely on original node for getting comment tags (closes [#90](https://github.com/LeDDGroup/typescript-transform-paths/issues/90)) ([fa978c2](https://github.com/LeDDGroup/typescript-transform-paths/commit/fa978c2651f74ba3ce7d7363ac5a0b3677a8e90c)) | ||
## [2.2.0](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.1.0...v2.2.0) (2021-01-04) | ||
@@ -7,0 +15,0 @@ |
@@ -86,3 +86,3 @@ "use strict"; | ||
// Remove extension if implicit | ||
if (extension && implicitExtensions.includes(extension)) | ||
if (extension && implicitExtensions.includes(extension) && path_1.default.basename(moduleName) !== path_1.default.basename(filePath)) | ||
filePath = filePath.slice(0, -extension.length); | ||
@@ -93,11 +93,19 @@ return filePath[0] === "." || general_utils_1.isURL(filePath) ? filePath : `./${filePath}`; | ||
var _a, _b, _c; | ||
const targetNode = tsInstance.isStatement(node) | ||
let targetNode = tsInstance.isStatement(node) | ||
? node | ||
: (_a = tsInstance.findAncestor(node, tsInstance.isStatement)) !== null && _a !== void 0 ? _a : node; | ||
const jsDocTags = tsInstance.getJSDocTags(targetNode); | ||
const trivia = targetNode.getFullText(sourceFile).slice(0, targetNode.getLeadingTriviaWidth(sourceFile)); | ||
targetNode = tsInstance.getOriginalNode(targetNode); | ||
let jsDocTags; | ||
try { | ||
jsDocTags = tsInstance.getJSDocTags(targetNode); | ||
} | ||
catch (_d) { } | ||
const commentTags = new Map(); | ||
const regex = /^\s*\/\/\/?\s*@(transform-path|no-transform-path)(?:[^\S\r\n](.+?))?$/gm; | ||
for (let match = regex.exec(trivia); match; match = regex.exec(trivia)) | ||
commentTags.set(match[1], match[2]); | ||
try { | ||
const trivia = targetNode.getFullText(sourceFile).slice(0, targetNode.getLeadingTriviaWidth(sourceFile)); | ||
const regex = /^\s*\/\/\/?\s*@(transform-path|no-transform-path)(?:[^\S\r\n](.+?))?$/gm; | ||
for (let match = regex.exec(trivia); match; match = regex.exec(trivia)) | ||
commentTags.set(match[1], match[2]); | ||
} | ||
catch (_e) { } | ||
return { | ||
@@ -104,0 +112,0 @@ overridePath: (_b = commentTags.get("transform-path")) !== null && _b !== void 0 ? _b : (_c = jsDocTags === null || jsDocTags === void 0 ? void 0 : jsDocTags.find((t) => t.tagName.text.toLowerCase() === "transform-path")) === null || _c === void 0 ? void 0 : _c.comment, |
{ | ||
"name": "typescript-transform-paths", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Transforms module resolution paths using TypeScript path mapping", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -122,3 +122,3 @@ # typescript-transform-paths | ||
"useRootDirs": true, | ||
exclude: [ "**/node_modules/**" ] | ||
"exclude": [ "**/node_modules/**" ] | ||
} | ||
@@ -125,0 +125,0 @@ ] |
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
50533
491