Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@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 159,043 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.