Socket
Socket
Sign inDemoInstall

typescript-transform-paths

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-transform-paths - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [2.2.2](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.2.1...v2.2.2) (2021-01-11)
### Bug Fixes
* Corrected explicit extensions fix from previous patch ([a90e550](https://github.com/LeDDGroup/typescript-transform-paths/commit/a90e550a3d0c4804ef3a4e27cbc4e32ce6971296))
### [2.2.1](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.2.0...v2.2.1) (2021-01-10)

@@ -7,0 +14,0 @@

24

dist/utils/resolve-path-update-node.js

@@ -9,5 +9,10 @@ "use strict";

const general_utils_1 = require("./general-utils");
/* ****************************************************************************************************************** *
* Node Updater
* ****************************************************************************************************************** */
/* ****************************************************************************************************************** */
// region: Config
/* ****************************************************************************************************************** */
const explicitExtensions = [".js", ".jsx"];
// endregion
/* ****************************************************************************************************************** */
// region: Node Updater Utility
/* ****************************************************************************************************************** */
/**

@@ -87,6 +92,14 @@ * Gets proper path and calls updaterFn to get the new node if it should be updated

// Remove extension if implicit
if (extension && implicitExtensions.includes(extension) && path_1.default.basename(moduleName) !== path_1.default.basename(filePath))
filePath = filePath.slice(0, -extension.length);
if (extension && implicitExtensions.includes(extension))
filePath = filePath.slice(0, -extension.length) + maybeGetExplicitJsExtension(filePath, extension);
return filePath[0] === "." || general_utils_1.isURL(filePath) ? filePath : `./${filePath}`;
}
function maybeGetExplicitJsExtension(filePath, resolvedExtension) {
const moduleExtension = path_1.default.extname(moduleName);
if (moduleExtension && !explicitExtensions.includes(moduleExtension))
return "";
return path_1.default.basename(moduleName, moduleExtension) === path_1.default.basename(filePath, resolvedExtension)
? moduleExtension
: "";
}
function getStatementTags() {

@@ -119,1 +132,2 @@ var _a, _b, _c;

exports.resolvePathAndUpdateNode = resolvePathAndUpdateNode;
// endregion
{
"name": "typescript-transform-paths",
"version": "2.2.1",
"version": "2.2.2",
"description": "Transforms module resolution paths using TypeScript path mapping",

@@ -5,0 +5,0 @@ "keywords": [

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