resolve-tspaths
Advanced tools
Comparing version 0.8.1 to 0.8.2
## [0.8.2](https://github.com/benyap/resolve-tspaths/compare/v0.8.1...v0.8.2) (2022-10-22) | ||
### Bug Fixes | ||
* paths ending with "ts" being incorrectly replaced ([1886a85](https://github.com/benyap/resolve-tspaths/commit/1886a856687091303f42fc13c0ad05a355b9bfad)) | ||
* resolve paths on windows correctly ([aff3ed0](https://github.com/benyap/resolve-tspaths/commit/aff3ed093d6e6426e301293a0c36ddaa7fea46a1)) | ||
### Documentation | ||
* add RedMser as a contributor for code, and bug ([#176](https://github.com/benyap/resolve-tspaths/issues/176)) ([2f60f55](https://github.com/benyap/resolve-tspaths/commit/2f60f55496f9d144e88f5c3babc5a71832288d58)) | ||
### Internal | ||
* **deps:** update jest monorepo ([#173](https://github.com/benyap/resolve-tspaths/issues/173)) ([ce8fa24](https://github.com/benyap/resolve-tspaths/commit/ce8fa2487b8f695dc477caa9190e30c5255282a1)) | ||
## [0.8.1](https://github.com/benyap/resolve-tspaths/compare/v0.8.0...v0.8.1) (2022-10-10) | ||
@@ -4,0 +22,0 @@ |
@@ -7,2 +7,3 @@ "use strict"; | ||
const errors_1 = require("../utils/errors"); | ||
const path_2 = require("../utils/path"); | ||
exports.IMPORT_EXPORT_REGEX = /((?:require\(|require\.resolve\(|import\()|(?:import|export) (?:.*from )?)['"]([^'"]*)['"]\)?/g; | ||
@@ -103,9 +104,14 @@ exports.ESM_IMPORT_EXPORT_REGEX = /(?:(?:import\()|(?:import|export)\s+(?:.*from\s+)?)['"]([^'"]*)['"]\)?/g; | ||
const prefixedRelativePath = relativeImportPath.replace(/^(?!\.+\/)/, (m) => "./" + m); | ||
const relativePathJsExtension = prefixedRelativePath.replace(/\.[^/.]*ts[^/.]*$/, (match) => match.replace("ts", "js")); | ||
const relativePathJsxExtension = relativePathJsExtension.replace(/\.jsx$/, (match) => isFile((0, path_1.resolve)(outputFileDirectory, relativePathJsExtension)) | ||
? match | ||
: ".js"); | ||
return Object.assign({ file: outputFile, original: importSpecifier }, (importSpecifier !== relativePathJsxExtension | ||
? { replacement: relativePathJsxExtension } | ||
: {})); | ||
const relativePathJsExtension = prefixedRelativePath.replace(/\.[^/.]*ts[^/.]*$/, (match) => match | ||
.replace(/\.ts$/, ".js") | ||
.replace(/\.tsx$/, ".jsx") | ||
.replace(/\.mts$/, ".mjs") | ||
.replace(/\.cts$/, ".cjs")); | ||
const jsxFileExists = isFile((0, path_1.resolve)(outputFileDirectory, relativePathJsExtension)); | ||
const relativePathJsxExtension = jsxFileExists | ||
? relativePathJsExtension | ||
: relativePathJsExtension.replace(/\.jsx$/, ".js"); | ||
return Object.assign({ file: (0, path_2.normalizePath)(outputFile), original: (0, path_2.normalizePath)(importSpecifier) }, (importSpecifier !== relativePathJsxExtension && { | ||
replacement: (0, path_2.normalizePath)(relativePathJsxExtension), | ||
})); | ||
} | ||
@@ -112,0 +118,0 @@ exports.aliasToRelativePath = aliasToRelativePath; |
@@ -6,9 +6,3 @@ "use strict"; | ||
const fast_glob_1 = require("fast-glob"); | ||
// See https://github.com/benyap/resolve-tspaths/pull/20 | ||
function normalisePath(windowsPath) { | ||
return windowsPath | ||
.replace(/^\\\\\?\\/, "") | ||
.replace(/\\/g, "/") | ||
.replace(/\/\/+/g, "/"); | ||
} | ||
const path_2 = require("../utils/path"); | ||
/** | ||
@@ -21,3 +15,3 @@ * Get the files in the output directory that should be processed. | ||
function getFilesToProcess(outPath, extensions) { | ||
const normalizedOutPath = normalisePath(outPath); | ||
const normalizedOutPath = (0, path_2.normalizePath)(outPath); | ||
let glob = "*"; | ||
@@ -24,0 +18,0 @@ if (extensions.length === 1) |
{ | ||
"version": "0.8.1" | ||
"version": "0.8.2" | ||
} |
{ | ||
"name": "resolve-tspaths", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "Transform path mappings in your compiled Typescript code", | ||
@@ -36,3 +36,3 @@ "author": "Ben Yap <contact@benyap.com>", | ||
"prepare": "husky install", | ||
"clean": "rm -rf ./dist/* ./coverage/*", | ||
"clean": "rimraf ./dist/* ./coverage/*", | ||
"prebuild": "yarn clean", | ||
@@ -62,8 +62,9 @@ "build": "tsc -p tsconfig.build.json", | ||
"@release-it/conventional-changelog": "5.1.1", | ||
"@types/jest": "29.1.2", | ||
"@types/jest": "29.2.0", | ||
"@types/node": "17.0.38", | ||
"husky": "8.0.1", | ||
"jest": "29.1.2", | ||
"jest": "29.2.1", | ||
"prettier": "2.7.1", | ||
"release-it": "15.5.0", | ||
"rimraf": "3.0.2", | ||
"ts-jest": "29.0.3", | ||
@@ -70,0 +71,0 @@ "ts-node": "10.9.1", |
@@ -197,13 +197,14 @@ # resolve-tspaths | ||
<tr> | ||
<td align="center"><a href="https://github.com/benyap"><img src="https://avatars.githubusercontent.com/u/19235373?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Ben Yap</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=benyap" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=benyap" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=benyap" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/Chocobozzz"><img src="https://avatars.githubusercontent.com/u/5180488?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Chocobozzz</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=Chocobozzz" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=Chocobozzz" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3AChocobozzz" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="https://qiaoruntao.com"><img src="https://avatars.githubusercontent.com/u/5846433?v=4?s=80" width="80px;" alt=""/><br /><sub><b>qiaoruntao</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=qiaoruntao" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=qiaoruntao" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/4nickel"><img src="https://avatars.githubusercontent.com/u/57354511?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Felix Viernickel</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3A4nickel" title="Bug reports">🐛</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=4nickel" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=4nickel" title="Code">💻</a></td> | ||
<td align="center"><a href="http://kaic.dev"><img src="https://avatars.githubusercontent.com/u/9873486?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Kaic Bastidas</b></sub></a><br /><a href="#ideas-tcK1" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="https://github.com/Atlinx"><img src="https://avatars.githubusercontent.com/u/25368491?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Atlinx</b></sub></a><br /><a href="#ideas-Atlinx" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="http://wintercounter.me"><img src="https://avatars.githubusercontent.com/u/963776?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Victor Vincent</b></sub></a><br /><a href="#ideas-wintercounter" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3Awintercounter" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="https://github.com/benyap"><img src="https://avatars.githubusercontent.com/u/19235373?v=4?s=80" width="80px;" alt="Ben Yap"/><br /><sub><b>Ben Yap</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=benyap" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=benyap" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=benyap" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/Chocobozzz"><img src="https://avatars.githubusercontent.com/u/5180488?v=4?s=80" width="80px;" alt="Chocobozzz"/><br /><sub><b>Chocobozzz</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=Chocobozzz" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=Chocobozzz" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3AChocobozzz" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="https://qiaoruntao.com"><img src="https://avatars.githubusercontent.com/u/5846433?v=4?s=80" width="80px;" alt="qiaoruntao"/><br /><sub><b>qiaoruntao</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=qiaoruntao" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=qiaoruntao" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/4nickel"><img src="https://avatars.githubusercontent.com/u/57354511?v=4?s=80" width="80px;" alt="Felix Viernickel"/><br /><sub><b>Felix Viernickel</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3A4nickel" title="Bug reports">🐛</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=4nickel" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=4nickel" title="Code">💻</a></td> | ||
<td align="center"><a href="http://kaic.dev"><img src="https://avatars.githubusercontent.com/u/9873486?v=4?s=80" width="80px;" alt="Kaic Bastidas"/><br /><sub><b>Kaic Bastidas</b></sub></a><br /><a href="#ideas-tcK1" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="https://github.com/Atlinx"><img src="https://avatars.githubusercontent.com/u/25368491?v=4?s=80" width="80px;" alt="Atlinx"/><br /><sub><b>Atlinx</b></sub></a><br /><a href="#ideas-Atlinx" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="http://wintercounter.me"><img src="https://avatars.githubusercontent.com/u/963776?v=4?s=80" width="80px;" alt="Victor Vincent"/><br /><sub><b>Victor Vincent</b></sub></a><br /><a href="#ideas-wintercounter" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3Awintercounter" title="Bug reports">🐛</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://www.linkedin.com/in/forest-beaver-110965159/"><img src="https://avatars.githubusercontent.com/u/33011274?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Forest</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3AForestBeaver" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="http://einhorn.jetzt"><img src="https://avatars.githubusercontent.com/u/1557253?v=4?s=80" width="80px;" alt=""/><br /><sub><b>Zebreus</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3AZebreus" title="Bug reports">🐛</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=Zebreus" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=Zebreus" title="Code">💻</a></td> | ||
<td align="center"><a href="https://www.linkedin.com/in/forest-beaver-110965159/"><img src="https://avatars.githubusercontent.com/u/33011274?v=4?s=80" width="80px;" alt="Forest"/><br /><sub><b>Forest</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3AForestBeaver" title="Bug reports">🐛</a></td> | ||
<td align="center"><a href="http://einhorn.jetzt"><img src="https://avatars.githubusercontent.com/u/1557253?v=4?s=80" width="80px;" alt="Zebreus"/><br /><sub><b>Zebreus</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3AZebreus" title="Bug reports">🐛</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=Zebreus" title="Tests">⚠️</a> <a href="https://github.com/benyap/resolve-tspaths/commits?author=Zebreus" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/RedMser"><img src="https://avatars.githubusercontent.com/u/5117197?v=4?s=80" width="80px;" alt="RedMser"/><br /><sub><b>RedMser</b></sub></a><br /><a href="https://github.com/benyap/resolve-tspaths/commits?author=RedMser" title="Code">💻</a> <a href="https://github.com/benyap/resolve-tspaths/issues?q=author%3ARedMser" title="Bug reports">🐛</a></td> | ||
</tr> | ||
@@ -210,0 +211,0 @@ </tbody> |
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
75463
33
707
226
15