Comparing version 1.2.4 to 1.2.5
@@ -10,7 +10,7 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const util_1 = require("./util"); | ||
const helpers_1 = require("./helpers"); | ||
function replaceTscAliasPaths(options = { | ||
watch: false, | ||
}) { | ||
console.log('=== tsc-alias starting ==='); | ||
console_utils_1.Output.info('=== tsc-alias starting ==='); | ||
if (!options.configFile) { | ||
@@ -28,3 +28,3 @@ options.configFile = path_1.resolve(process.cwd(), 'tsconfig.json'); | ||
} | ||
let { baseUrl, outDir, paths } = util_1.loadConfig(configFile); | ||
let { baseUrl, outDir, paths } = helpers_1.loadConfig(configFile); | ||
if (options.outDir) { | ||
@@ -51,3 +51,3 @@ outDir = options.outDir; | ||
const _paths = paths[alias].map((path) => { | ||
path = path.replace(/\*$/, '').replace('.ts', ''); | ||
path = path.replace(/\*$/, '').replace('.t', '.j'); | ||
if (path_1.isAbsolute(path)) { | ||
@@ -63,3 +63,3 @@ path = path_1.relative(configDir, path); | ||
if (!configDirInOutPath) { | ||
configDirInOutPath = util_1.getProjectDirPathInOutDir(outPath, confDirParentFolderName); | ||
configDirInOutPath = helpers_1.getProjectDirPathInOutDir(outPath, confDirParentFolderName); | ||
if (configDirInOutPath) { | ||
@@ -101,3 +101,4 @@ hasExtraModule = true; | ||
: ''}/${baseUrl}`)); | ||
if (fs_1.existsSync(`${tempBasePath}/${alias.path}`)) { | ||
const absoluteBasePath = normalizePath(path_1.normalize(`${tempBasePath}/${alias.path}`)); | ||
if (helpers_1.existsResolvedAlias(absoluteBasePath)) { | ||
alias.isExtra = false; | ||
@@ -108,3 +109,3 @@ alias.basePath = tempBasePath; | ||
alias.isExtra = true; | ||
alias.basePath = normalizePath(path_1.normalize(`${tempBasePath}/${alias.path}`)); | ||
alias.basePath = absoluteBasePath; | ||
} | ||
@@ -128,4 +129,3 @@ } | ||
if (index > -1 && isAlias) { | ||
let absoluteAliasPath; | ||
absoluteAliasPath = normalizePath(path_1.normalize(`${alias.basePath}/${alias.path}`)); | ||
let absoluteAliasPath = helpers_1.getAbsoluteAliasPath(alias.basePath, alias.path); | ||
let relativeAliasPath = normalizePath(path_1.relative(path_1.dirname(file), absoluteAliasPath)); | ||
@@ -132,0 +132,0 @@ if (!relativeAliasPath.startsWith('.')) { |
{ | ||
"name": "tsc-alias", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Replace absolute paths to relative paths after typescript compilation", | ||
@@ -13,8 +13,7 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "npm run clean && tsc", | ||
"build:watch": "tsc -w", | ||
"clean": "rimraf dist", | ||
"prepublish": "npm run build", | ||
"build:dev": "tsc -w", | ||
"release:patch": "tsc && npm test && npm version patch", | ||
"postversion": "git push && git push --tags && npm publish", | ||
"format": "prettier --write \"**/*.{js,ts}\"" | ||
"format": "prettier --write \"**/*.{js,ts}\"", | ||
"test": "jest" | ||
}, | ||
@@ -50,7 +49,12 @@ "repository": { | ||
"devDependencies": { | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^11.12.0", | ||
"@types/shelljs": "^0.8.8", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"rimraf": "^3.0.2", | ||
"shelljs": "^0.8.4", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^4.1.2" | ||
} | ||
} |
@@ -6,3 +6,2 @@ # tsc-alias | ||
[![npm version](https://badge.fury.io/js/tsc-alias.svg)](https://badge.fury.io/js/tsc-alias) | ||
[![Dependency Status](https://david-dm.org/justkey007/tsc-alias.svg)](https://david-dm.org/justkey007/tsc-alias) | ||
[![License](https://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) | ||
@@ -9,0 +8,0 @@ |
Sorry, the diff of this file is not supported yet
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
37320
324
9
83
2