Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@module-federation/dts-plugin
Advanced tools
@module-federation/dts-plugin is a plugin designed to generate TypeScript declaration files (d.ts) for federated modules. It helps in creating type definitions for modules that are shared across different applications using Module Federation, ensuring type safety and better developer experience.
Generate TypeScript Declarations
This feature allows you to generate TypeScript declaration files for your federated modules. By configuring the DtsPlugin with the necessary options, you can ensure that your shared components have the appropriate type definitions.
const { DtsPlugin } = require('@module-federation/dts-plugin');
module.exports = {
plugins: [
new DtsPlugin({
name: 'my-federated-module',
filename: 'remoteEntry.js',
exposes: {
'./Component': './src/Component',
},
}),
],
};
Custom Output Directory
This feature allows you to specify a custom output directory for the generated TypeScript declaration files. By setting the `outputDir` option, you can control where the type definitions are saved.
const { DtsPlugin } = require('@module-federation/dts-plugin');
module.exports = {
plugins: [
new DtsPlugin({
name: 'my-federated-module',
filename: 'remoteEntry.js',
exposes: {
'./Component': './src/Component',
},
outputDir: 'types',
}),
],
};
TypeScript Configuration
This feature allows you to specify a custom TypeScript configuration file for generating the declaration files. By setting the `tsConfigFile` option, you can ensure that the TypeScript compiler uses the correct settings.
const { DtsPlugin } = require('@module-federation/dts-plugin');
module.exports = {
plugins: [
new DtsPlugin({
name: 'my-federated-module',
filename: 'remoteEntry.js',
exposes: {
'./Component': './src/Component',
},
tsConfigFile: 'tsconfig.json',
}),
],
};
The TypeScript package itself can be used to generate declaration files using the `tsc` command with the `--declaration` flag. However, it does not provide the same level of integration with Module Federation as @module-federation/dts-plugin.
dts-bundle is a tool that can bundle multiple TypeScript declaration files into a single file. While it can be used to manage type definitions, it does not specifically cater to the needs of Module Federation.
rollup-plugin-dts is a Rollup plugin that generates TypeScript declaration files. It can be used in a Rollup-based build process, but it does not have built-in support for Module Federation like @module-federation/dts-plugin.
FAQs
Unknown package
The npm package @module-federation/dts-plugin receives a total of 684,599 weekly downloads. As such, @module-federation/dts-plugin popularity was classified as popular.
We found that @module-federation/dts-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.