From c0bf5b721780683b5e32f076f9b5290784272b26 Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Wed, 6 May 2026 12:39:19 +0200 Subject: [PATCH] chore(dts-plugin): drop ansi-colors dependency --- .changeset/drop-ansi-colors-dts-plugin.md | 5 +++++ packages/dts-plugin/package.json | 1 - packages/dts-plugin/src/core/lib/utils.ts | 6 ++++-- pnpm-lock.yaml | 3 --- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 .changeset/drop-ansi-colors-dts-plugin.md diff --git a/.changeset/drop-ansi-colors-dts-plugin.md b/.changeset/drop-ansi-colors-dts-plugin.md new file mode 100644 index 00000000000..e292e061f8e --- /dev/null +++ b/.changeset/drop-ansi-colors-dts-plugin.md @@ -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. diff --git a/packages/dts-plugin/package.json b/packages/dts-plugin/package.json index 3b25518ea56..e3bb5d4f943 100644 --- a/packages/dts-plugin/package.json +++ b/packages/dts-plugin/package.json @@ -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", diff --git a/packages/dts-plugin/src/core/lib/utils.ts b/packages/dts-plugin/src/core/lib/utils.ts index c37fbc2dc45..77a65fa6c06 100644 --- a/packages/dts-plugin/src/core/lib/utils.ts +++ b/packages/dts-plugin/src/core/lib/utils.ts @@ -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'; @@ -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}`), + ); return { apiTypesPath: '', zipTypesPath: '', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e13c22a0d9..47ac6bbb048 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3226,9 +3226,6 @@ importers: adm-zip: specifier: 0.5.10 version: 0.5.10 - ansi-colors: - specifier: 4.1.3 - version: 4.1.3 isomorphic-ws: specifier: 5.0.0 version: 5.0.0(ws@8.18.0)