Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@xiboon/tspath
Advanced tools
TypeScript Path Igniter resolves @paths specified in tsconfig
Everyone working in a TypeScript project that grows beyond a certains limit will eventually experience the situation commonly described as path hell, the snippet below is an example of such hell.
import { IgniterApplication } from "../../../Application/IgniterApplication";
import { CrcCalculator } from "../../../../../../../Utilities/FileUtilities";
import { IMessageHandler } from "../../../../Messaging/IMessageHandler";
import { IMessageHub } from "../../../../Messaging/Hub/IMessageHub";
import { CronTabHelper } from "../../../../../../../Utilities/CronTabHelper";
import { GLog } from "../../../Application/GLog";
By specifying path aliases in tsconfig.json you can use that alias to form an "absolute path"
{
"compilerOptions": {
...
"paths": {
"@App/*": ["./Application/*"],
"@Messaging/*": ["./Messaging/*"],
"@Utils/*": ["./Server/Tools/Utilities/*"]
}
}
}
For full compability with the internal JavaScript parser,
specify es5 as target.
{
"compilerOptions": {
"target": "es5"
...
}
}
Below is the sample example but with Path Aliases instead of relative paths added, as you can see, the readability have improved significantly!
import { IgniterApplication } from "@App/IgniterApplication";
import { CrcCalculator } from "@Utils/FileUtilities";
import { IMessageHandler } from "@Messaging/IMessageHandler";
import { IMessageHub } from "@Messaging/Hub/IMessageHub";
import { CronTabHelper } from "@Utils/CronTabHelper";
import { GLog } from "@App/GLog";
The TypeScript compiler will be able to resolve the paths so this will compile without problems, however the JavaScript output will not be possible to execute by Node nor a Web Browser, why? the reason is simple!
The JavaScript engine does not know anything about the compile time TypeScript configuration.
In order to run your JavaScript code, the path aliases now needs to be made into relative paths again, here is when TSPath comes into play.
So, simply run:
$ tspath
Yes, that´s it, really!
Running headless, slip in a -f in order to bypass the confirmation prompt.
$ tspath -f
Say bye bye to the relative path hell!
FAQs
TypeScript Path Igniter resolves @paths specified in tsconfig
We found that @xiboon/tspath demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.