Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace strip-ansi with native module #1366

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 1 addition & 2 deletions packages/metro-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"devDependencies": {
"@types/connect": "^3.4.35",
"metro-babel-register": "0.80.11",
"pretty-format": "^29.7.0",
"strip-ansi": "^6.0.0"
"pretty-format": "^29.7.0"
},
"engines": {
"node": ">=18.18"
Expand Down
6 changes: 3 additions & 3 deletions packages/metro-config/src/__tests__/loadConfig-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {loadConfig} = require('../loadConfig');
const cosmiconfig = require('cosmiconfig');
const path = require('path');
const prettyFormat = require('pretty-format');
const stripAnsi = require('strip-ansi');
const util = require('util');

describe('loadConfig', () => {
beforeEach(() => {
Expand Down Expand Up @@ -182,7 +182,7 @@ describe('loadConfig', () => {
try {
await loadConfig({});
} catch (error) {
expect(stripAnsi(error.message)).toMatchSnapshot();
expect(util.stripVTControlCharacters(error.message)).toMatchSnapshot();
}
});

Expand All @@ -198,7 +198,7 @@ describe('loadConfig', () => {
try {
await loadConfig({});
} catch (error) {
expect(stripAnsi(error.message)).toMatchSnapshot();
expect(util.stripVTControlCharacters(error.message)).toMatchSnapshot();
}
});

Expand Down
1 change: 0 additions & 1 deletion packages/metro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"nullthrows": "^1.1.1",
"serialize-error": "^2.1.0",
"source-map": "^0.5.6",
"strip-ansi": "^6.0.0",
"throat": "^5.0.0",
"ws": "^7.5.10",
"yargs": "^17.6.2"
Expand Down
3 changes: 1 addition & 2 deletions packages/metro/src/lib/reporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {CustomResolverOptions} from 'metro-resolver';
import type {CustomTransformOptions} from 'metro-transform-worker';

const chalk = require('chalk');
const stripAnsi = require('strip-ansi');
const util = require('util');

export type BundleDetails = {
Expand Down Expand Up @@ -207,7 +206,7 @@ function logError(
// in various places outside of where Metro is currently running.
// If the current terminal does not support color, we'll strip the colors
// here.
util.format(chalk.supportsColor ? format : stripAnsi(format), ...args),
util.format(chalk.supportsColor ? format : util.stripVTControlCharacters(format), ...args),
);
}

Expand Down
Loading