Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/drop-ansi-colors-dts-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/dts-plugin': patch
---

chore(dts-plugin): drop `ansi-colors` dependency in favor of inline ANSI escape for the single red error message.
1 change: 0 additions & 1 deletion packages/dts-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"@module-federation/sdk": "workspace:*",
"@module-federation/third-party-dts-extractor": "workspace:*",
"adm-zip": "0.5.10",
"ansi-colors": "4.1.3",
"isomorphic-ws": "5.0.0",
"undici": "7.24.7",
"node-schedule": "2.1.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/dts-plugin/src/core/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import { styleText } from 'node:util';
import { moduleFederationPlugin, getProcessEnv } from '@module-federation/sdk';
import ansiColors from 'ansi-colors';
import { Agent } from 'undici';
import { retrieveRemoteConfig } from '../configurations/remotePlugin';
import { HostOptions } from '../interfaces/HostOptions';
Expand Down Expand Up @@ -63,7 +63,9 @@ export function retrieveTypesAssetsInfo(options: RemoteOptions) {
apiFileName: path.basename(apiTypesPath),
};
} catch (err) {
console.error(ansiColors.red(`Unable to compile federated types, ${err}`));
console.error(
styleText('red', `Unable to compile federated types, ${err}`),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid util.styleText without raising Node floor

retrieveTypesAssetsInfo now calls styleText, but util.styleText was only added in Node v20.12.0. This package has no engines guard and the repo declares node: ^20, which still includes 20.0–20.11, so users on those supported runtimes will hit TypeError: styleText is not a function in the error path and lose the original diagnostic. Please keep a backward-compatible colorization fallback (or explicitly raise/enforce the minimum Node version).

Useful? React with 👍 / 👎.

);
return {
apiTypesPath: '',
zipTypesPath: '',
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.