
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
rollup-plugin-dts-alias
Advanced tools
Create a Rollup plugin to replace import paths in .d.ts files in the dist directory
The dts-alias-transformer
is a Rollup plugin designed to replace import paths in .d.ts
files located in the dist
directory based on provided alias mappings. This plugin can be especially useful in projects where you need to adjust import paths to accommodate different directory structures.
To use this plugin, you need to have Rollup installed in your project. You can install it via npm or yarn:
npm install --save-dev rollup dts-alias-transformer
or
yarn add --dev rollup dts-alias-transformer
Usage To use the dts-alias-transformer plugin, you need to import it in your Rollup configuration file (usually rollup.config.js) and provide it with the necessary options.
export default {
input: 'src/index.js',
output: {
dir: 'dist',
format: 'cjs',
},
plugins: [
dtsAliasPlugin({
alias: {
'@': '..', // Replace '@' with the parent directory
},
outputDir: 'dist', // Specify the output directory
}),
],
};
Assume you have the following import statement in your dist/example.d.ts file:
import { HttpMethod } from "@/http";
If you set the alias mapping to replace @ with .., the import statement will be transformed as follows:
import { HttpMethod } from "../http";
The plugin will log the relative paths of all processed .d.ts files to the console, so you can keep track of which files were modified.
This project is licensed under the MIT License. See the LICENSE file for more details.
FAQs
Create a Rollup plugin to replace import paths in .d.ts files in the dist directory
The npm package rollup-plugin-dts-alias receives a total of 6 weekly downloads. As such, rollup-plugin-dts-alias popularity was classified as not popular.
We found that rollup-plugin-dts-alias demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.