Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

resolve-tspaths

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resolve-tspaths - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

18

CHANGELOG.md
## [0.7.2](https://github.com/benyap/resolve-tspaths/compare/v0.7.1...v0.7.2) (2022-07-27)
### Bug Fixes
* resolve path correctly when file and directory have same name ([9b4e7d1](https://github.com/benyap/resolve-tspaths/commit/9b4e7d1671795589a1dbfe797fc911cc3ad231ed))
### Internal
* **deps:** update dependency release-it to v15.2.0 ([#134](https://github.com/benyap/resolve-tspaths/issues/134)) ([07919bc](https://github.com/benyap/resolve-tspaths/commit/07919bcf7532684bfd5035c4390eb2efc4a4ecb4))
* **deps:** update dependency ts-jest to v28.0.7 ([#133](https://github.com/benyap/resolve-tspaths/issues/133)) ([5e589f9](https://github.com/benyap/resolve-tspaths/commit/5e589f9f9b4ed72d32f3209664d9401f54c9c8bf))
### Documentation
* add ForestBeaver as a contributor for bug ([#137](https://github.com/benyap/resolve-tspaths/issues/137)) ([9c1a496](https://github.com/benyap/resolve-tspaths/commit/9c1a496de7ed8f8a2822ab124e56eafbaf22d2a6))
## [0.7.1](https://github.com/benyap/resolve-tspaths/compare/v0.7.0...v0.7.1) (2022-07-16)

@@ -4,0 +22,0 @@

2

dist/steps/createProgram.js

@@ -5,3 +5,3 @@ "use strict";

const commander_1 = require("commander");
const version_json_1 = require("../version.json");
const version_json_1 = require("~/version.json");
const example = `

@@ -8,0 +8,0 @@ Example:

@@ -8,3 +8,3 @@ "use strict";

exports.IMPORT_EXPORT_REGEX = /(?:(?:require\(|require\.resolve\(|import\()|(?:import|export) (?:.*from )?)['"]([^'"]*)['"]\)?/g;
const PATHS = [
const EXTS = [
".js",

@@ -98,13 +98,22 @@ ".jsx",

const modulePath = (0, path_1.resolve)(aliasPath, pathRelative);
// File must exist in source directory
if ((0, fs_1.existsSync)(modulePath) ||
PATHS.some((ext) => (0, fs_1.existsSync)(`${modulePath}${ext}`))) {
const rel = (0, path_1.relative)((0, path_1.dirname)(srcFile), modulePath);
const replacement = rel.startsWith(".") ? rel : `./${rel}`;
return {
file: filePath,
original: path,
replacement: replacement.replace(/\\/g, "/"),
};
// Makes sure that a source file exists at the module's path
const ext = EXTS.find((ext) => (0, fs_1.existsSync)(`${modulePath}${ext}`));
if (typeof ext !== "string")
continue;
const srcDir = (0, path_1.dirname)(srcFile);
let newPath = (0, path_1.relative)(srcDir, modulePath);
// If the srcDir is the same as the modulePath and the matched extension
// does not start with "/", it means that there is a folder with the
// same name as the source file. We need to resolve the path relative
// to the source file, not the folder.
if (srcDir === modulePath && !ext.startsWith("/")) {
const regex = new RegExp(`${ext.replace(".", "\\.")}$`);
newPath = (0, path_1.relative)(srcDir, `${modulePath}${ext}`).replace(regex, "");
}
const replacement = newPath.startsWith(".") ? newPath : `./${newPath}`;
return {
file: filePath,
original: path,
replacement: replacement.replace(/\\/g, "/"),
};
}

@@ -111,0 +120,0 @@ }

{
"version": "0.7.1"
"version": "0.7.2"
}
{
"name": "resolve-tspaths",
"version": "0.7.1",
"version": "0.7.2",
"description": "Transform path mappings in your compiled Typescript code",

@@ -67,4 +67,4 @@ "author": "Ben Yap <contact@benyap.com>",

"prettier": "2.7.1",
"release-it": "15.1.2",
"ts-jest": "28.0.6",
"release-it": "15.2.0",
"ts-jest": "28.0.7",
"ts-node": "10.9.1",

@@ -71,0 +71,0 @@ "tsconfig-paths": "4.0.0",

@@ -198,2 +198,5 @@ # resolve-tspaths

</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>
</tr>
</table>

@@ -200,0 +203,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc