Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@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
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 7 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.