Socket
Socket
Sign inDemoInstall

tsc-alias

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsc-alias - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

@types/index.d.ts

15

package.json
{
"name": "tsc-alias",
"version": "1.0.2",
"version": "1.0.3",
"description": "Replace absolute paths to relative paths after typescript compilation",
"main": "cjs/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"main": "bin/index.js",
"module": "bin/index.js",
"types": "bin/index.d.ts",
"bin": {
"tsc-alias": "cjs/index.js"
"tsc-alias": "bin/index.js"
},
"scripts": {
"build": "npm run build:esm && npm run build:cjs",
"build:esm": "tsc -p ./tsconfig.esm.json",
"build:cjs": "tsc -p ./tsconfig.cjs.json",
"build": "tsc -p ./tsconfig.json",
"build:watch": "tsc -w -p ./tsconfig.json",
"clear": "rm -rf ./lib ./cjs ./coverage",

@@ -16,0 +15,0 @@ "format": "prettier --write \"./*.{js,jsx,ts,tsx}\" \"./src/**/*.{js,jsx,ts,tsx}\"",

@@ -14,2 +14,4 @@ # tsc-alias

```sh
npm install -g tsc-alias
#or
npm install --save-dev tsc-alias

@@ -26,2 +28,8 @@ # or

}
#or
"scripts": {
"build": "tsc && tsc-alias",
}
```

@@ -12,3 +12,3 @@ #! /usr/bin/env node

program
.version('0.0.1')
.version('1.0.2')
.option('-p, --project <file>', 'path to tsconfig.json');

@@ -18,2 +18,3 @@

console.log(`
$ tscpath
$ tscpath -p tsconfig.json

@@ -28,11 +29,7 @@ `);

};
if (!project) {
throw new Error('--project must be specified');
}
console.log('***tsc-alias starting***');
console.log = () => {};
console.info('***tsc-alias starting***');
const configFile = resolve(process.cwd(), project);
const configFile = resolve(process.cwd(), project ? project : 'tsconfig.json');
console.log(`tsconfig.json: ${configFile}`);

@@ -93,3 +90,3 @@

return {
prefix: alias.replace(/\*$/, ''),
prefix: alias.replace(/\*$/, '').replace(/\//g, ''),
basePath,

@@ -137,3 +134,3 @@ paths: _paths,

const index = orig.indexOf(alias.prefix);
const isAlias = requiredModule === alias.prefix;
const isAlias = requiredModule.indexOf(alias.prefix) === 0;
if (index > -1 && isAlias) {

@@ -149,4 +146,4 @@ let absoluteAliasPath;

// console.log('abs', absoluteAliasPath);
// console.log('fileDirName', dirname(file));
console.log('abs', absoluteAliasPath);
console.log('fileDirName', dirname(file));

@@ -156,3 +153,3 @@ let relativeAliasPath = normalizePath(

);
// console.log('rel', relativeAliasPath + '\n');
console.log('rel', relativeAliasPath + '\n');

@@ -202,2 +199,3 @@ if (relativeAliasPath[0] !== '.') {

const flen = files.length;
let replaceCount = 0;
for (let i = 0; i < flen; i += 1) {

@@ -208,4 +206,7 @@ const file = files[i];

if (text !== newText) {
replaceCount++;
writeFileSync(file, newText, 'utf8');
}
}
console.info(`${replaceCount} files have been replaced!`);
{
"compilerOptions": {
"watch": true,
"allowJs": false,

@@ -9,3 +10,3 @@ "allowSyntheticDefaultImports": false,

"declaration": true,
"declarationDir": "lib",
"declarationDir": "@types",
"diagnostics": true,

@@ -18,12 +19,12 @@ "forceConsistentCasingInFileNames": true,

"moduleResolution": "Node",
"noEmit": true,
"noEmit": false,
"noErrorTruncation": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"strictNullChecks": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"strictNullChecks": false,
"noUnusedParameters": true,
"outDir": "lib",
"outDir": "bin",
"paths": {

@@ -41,3 +42,3 @@ "src/*": ["src/*"]

"include": ["node_modules/@types", "src/**/*"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "**/*.spec.*", "**/*.test.*"]
}
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