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.0.3 to 2.0.4

12

CHANGELOG.md

@@ -5,4 +5,16 @@ # Changelog

### [2.0.4](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.0.3...v2.0.4) (2020-11-23)
### Bug Fixes
* General improvements ([39c69ae](https://github.com/LeDDGroup/typescript-transform-paths/commit/39c69ae0c8a0875199f3777500c7a37e4191dc93))
### [2.0.3](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.0.2...v2.0.3) (2020-11-17)
### Bug Fixes
* Updated to more sound workaround for TS type-elision issue ([fb33832](https://github.com/LeDDGroup/typescript-transform-paths/commit/fb338322e5fcd3b3ee7d45269287006ddec1bdb6))
### [2.0.2](https://github.com/LeDDGroup/typescript-transform-paths/compare/v2.0.1...v2.0.2) (2020-10-23)

@@ -9,0 +21,0 @@

38

lib/index.js

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

};
var isURL = function (s) {
return !!s && (!!url_1.default.parse(s).host || !!url_1.default.parse(s).hostname);
};
var isURL = function (s) { return !!s && (!!url_1.default.parse(s).host || !!url_1.default.parse(s).hostname); };
var isBaseDir = function (base, dir) { var _a; return ((_a = path_1.default.relative(base, dir)) === null || _a === void 0 ? void 0 : _a[0]) !== "."; };

@@ -55,4 +53,3 @@ var isRequire = function (node) {

var fileDir = typescript_1.default.normalizePath(path_1.default.dirname(fileName));
var baseUrl = compilerOptions.baseUrl;
if (!baseUrl || !compilerOptions.paths)
if (!compilerOptions.baseUrl && !compilerOptions.paths)
return sourceFile;

@@ -89,7 +86,5 @@ var rootDirs = (_a = compilerOptions.rootDirs) === null || _a === void 0 ? void 0 : _a.filter(path_1.default.isAbsolute);

var rootDir = rootDirs_1[_i];
if (isBaseDir(rootDir, resolvedFileName) &&
rootDir.length > moduleRootDir.length)
if (isBaseDir(rootDir, resolvedFileName) && rootDir.length > moduleRootDir.length)
moduleRootDir = rootDir;
if (isBaseDir(rootDir, fileName) &&
rootDir.length > fileRootDir.length)
if (isBaseDir(rootDir, fileName) && rootDir.length > fileRootDir.length)
fileRootDir = rootDir;

@@ -111,3 +106,4 @@ }

}
return updaterFn(typescript_1.default.createLiteral(p));
var newStringLiteral = factory ? factory.createStringLiteral(p) : typescript_1.default.createLiteral(p);
return updaterFn(newStringLiteral);
}

@@ -149,8 +145,5 @@ /**

/* Update ExternalModuleReference - import foo = require("foo"); */
if (typescript_1.default.isExternalModuleReference(node) &&
typescript_1.default.isStringLiteral(node.expression))
if (typescript_1.default.isExternalModuleReference(node) && typescript_1.default.isStringLiteral(node.expression))
return update(node, node.expression.text, function (p) {
return factory
? factory.updateExternalModuleReference(node, p)
: typescript_1.default.updateExternalModuleReference(node, p);
return factory ? factory.updateExternalModuleReference(node, p) : typescript_1.default.updateExternalModuleReference(node, p);
});

@@ -170,9 +163,14 @@ /**

return update(node, node.moduleSpecifier.text, function (p) {
return factory
? Object.assign(node, {
moduleSpecifier: p,
})
: Object.assign(node, {
if (factory) {
var newNode = factory.cloneNode(node.moduleSpecifier);
typescript_1.default.setSourceMapRange(newNode, typescript_1.default.getSourceMapRange(node));
typescript_1.default.setTextRange(newNode, node.moduleSpecifier);
newNode.text = p.text;
return Object.assign(node, { moduleSpecifier: newNode });
}
else {
return Object.assign(node, {
moduleSpecifier: typescript_1.default.updateNode(p, node.moduleSpecifier),
});
}
});

@@ -179,0 +177,0 @@ /* Update ImportTypeNode - typeof import("./bar"); */

{
"name": "typescript-transform-paths",
"version": "2.0.3",
"version": "2.0.4",
"description": "Transforms absolute imports to relative",

@@ -40,9 +40,10 @@ "keywords": [

"scripts": {
"prebuild": "rimraf lib",
"build": "tsc",
"format": "prettier --write \"{tests,src}/**/*.{js,ts}\"",
"test": "jest",
"release": "standard-version",
"--------------": "",
"prebuild": "rimraf lib",
"install:tests": "cd tests/__fixtures/specific && npm install",
"prepare": "npm run build && npm run install:tests",
"format": "prettier --write \"{tests,src}/**/*.{js,ts}\"",
"test": "jest"
"prepare": "npm run build && npm run install:tests"
},

@@ -62,9 +63,12 @@ "jest": {

"standard-version": "^8.0.1",
"ts-expose-internals": "^4.0.2",
"ts-expose-internals": "^4.0.5",
"ts-jest": "^24.0.2",
"ts-node": "^8.10.2",
"ttypescript": "^1.5.6",
"typescript": "^4.0.2",
"typescript": "^4.0.5",
"prettier": "^2.1.2"
},
"prettier": {
"printWidth": 120
}
}
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