
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
typescript-transform-paths
Advanced tools
Transforms absolute imports to relative from paths
in your tsconfig.json
npm:
npm i -D typescript-transform-paths
yarn:
yarn add -D typescript-transform-paths
Add it to plugins in your tsconfig.json
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@utils/*": ["utils/*"]
},
"plugins": [{ "transform": "typescript-transform-paths" }]
}
}
If you want to generate declaration (.d.ts) files with transformed paths you have to modify your tsconfig.json file:
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@utils/*": ["utils/*"]
},
"declaration": true,
"plugins": [
{ "transform": "typescript-transform-paths" },
{ "transform": "typescript-transform-paths", "afterDeclarations": true }
]
}
See issue4 for more information.
TS allows defining
virtual directories
via the rootDirs
compiler option. To enable virtual directory mapping, use the useRootDirs
plugin option.
{
"compilerOptions": {
"rootDirs": [ "src", "generated" ],
"baseUrl": ".",
"paths": {
"#root/*": [ "./src/*", "./generated/*" ]
},
"plugins": [
{ "transform": "typescript-transform-paths", useRootDirs: true },
]
}
}
- src/
- subdir/
- sub-file.ts
- file1.ts
- generated/
- file2.ts
src/file1.ts
import '#root/file2.ts' // resolves to './file2'
src/subdir/sub-file.ts
import '#root/file2.ts' // resolves to '../file2'
import '#root/file1.ts' // resolves to '../file1'
// tsconfig.json
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@utils/*": ["utils/*"]
}
}
}
// core/index.ts
import { sum } from "@utils/sum";
sum(2, 3);
Gets compiled to:
// core/index.js
var sum_1 = require("../utils/sum");
sum_1.sum(2, 3);
npm install --global prettier
prettier --write src/index.ts
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Transforms module resolution paths using TypeScript path mapping and/or custom paths
The npm package typescript-transform-paths receives a total of 216,208 weekly downloads. As such, typescript-transform-paths popularity was classified as popular.
We found that typescript-transform-paths demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.