From 8f60a3546bb3fbc8bb48c7bab6e65cd285d70100 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Sat, 27 Apr 2024 05:54:59 +1000 Subject: [PATCH] BREAKING(console): remove `std/console` (#4643) --- .github/workflows/title.yml | 1 - .gitignore | 2 +- README.md | 1 - _tools/check_circular_package_dependencies.ts | 3 -- console/mod.ts | 25 ---------- console/unicode_width.ts | 48 ------------------- 6 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 console/mod.ts delete mode 100644 console/unicode_width.ts diff --git a/.github/workflows/title.yml b/.github/workflows/title.yml index 3c326347719f..85a936822887 100644 --- a/.github/workflows/title.yml +++ b/.github/workflows/title.yml @@ -43,7 +43,6 @@ jobs: bytes cli collections - console crypto csv data_structures diff --git a/.gitignore b/.gitignore index 783bfd974568..75709bc7a885 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ **/cov/ crypto/_wasm/target deno.lock -console/testdata/unicode_width_crate/target +cli/testdata/unicode_width_crate/target html_cov/ cov.lcov http/testdata/%25A.txt diff --git a/README.md b/README.md index 1f084771ae03..fb9ac8c1278e 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,6 @@ requirements: | [bytes](https://jsr.io/@std/bytes) | Settled | [![JSR](https://jsr.io/badges/@std/bytes)](https://jsr.io/@std/bytes) | | [cli](https://jsr.io/@std/cli) | Unstable | [![JSR](https://jsr.io/badges/@std/cli)](https://jsr.io/@std/cli) | | [collections](https://jsr.io/@std/collections) | Settled | [![JSR](https://jsr.io/badges/@std/collections)](https://jsr.io/@std/collections) | -| [console](https://jsr.io/@std/console) | Deprecated | [![JSR](https://jsr.io/badges/@std/console)](https://jsr.io/@std/console) | | [crypto](https://jsr.io/@std/crypto) | Settled | [![JSR](https://jsr.io/badges/@std/crypto)](https://jsr.io/@std/crypto) | | [csv](https://jsr.io/@std/csv) | Settled | [![JSR](https://jsr.io/badges/@std/csv)](https://jsr.io/@std/csv) | | [data_structures](https://jsr.io/@std/data_structures) | Unstable | [![JSR](https://jsr.io/badges/@std/data-structures)](https://jsr.io/@std/data-structures) | diff --git a/_tools/check_circular_package_dependencies.ts b/_tools/check_circular_package_dependencies.ts index 2aa97467261b..051f6eda572a 100644 --- a/_tools/check_circular_package_dependencies.ts +++ b/_tools/check_circular_package_dependencies.ts @@ -38,7 +38,6 @@ type Mod = | "bytes" | "cli" | "collections" - | "console" | "crypto" | "csv" | "data_structures" @@ -79,7 +78,6 @@ const ENTRYPOINTS: Record = { bytes: ["mod.ts"], cli: ["mod.ts"], collections: ["mod.ts"], - console: ["mod.ts"], crypto: ["mod.ts"], csv: ["mod.ts"], data_structures: ["mod.ts"], @@ -129,7 +127,6 @@ const STABILITY: Record = { bytes: "Stable", cli: "Unstable", collections: "Stable", - console: "Unstable", crypto: "Stable", csv: "Stable", data_structures: "Unstable", diff --git a/console/mod.ts b/console/mod.ts deleted file mode 100644 index 5810b5265cf2..000000000000 --- a/console/mod.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -/** - * Functions for console-related tasks such as TTY text layout. - * - * ## Unicode width - * - * {@linkcode unicodeWidth} calculates the physical width of a string in a - * TTY-like environment. - * - * ```ts - * import { unicodeWidth } from "https://deno.land/std@$STD_VERSION/console/unicode_width.ts"; - * - * unicodeWidth("天地玄黃宇宙洪荒"); // 16 - * ``` - * - * @deprecated Use {@link https://jsr.io/@std/cli | std/cli} instead. This - * module will be removed once the Standard Library migrates to - * {@link https://jsr.io/ | JSR}. - * - * @module - */ - -export * from "./unicode_width.ts"; diff --git a/console/unicode_width.ts b/console/unicode_width.ts deleted file mode 100644 index 538e25cfee95..000000000000 --- a/console/unicode_width.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -// Ported from unicode_width rust crate, Copyright (c) 2015 The Rust Project Developers. MIT license. - -import { unicodeWidth as _unicodeWidth } from "../cli/unicode_width.ts"; - -/** - * Calculate the physical width of a string in a TTY-like environment. This is - * useful for cases such as calculating where a line-wrap will occur and - * underlining strings. - * - * The physical width is given by the number of columns required to display - * the string. The number of columns a given unicode character occupies can - * vary depending on the character itself. - * - * @param str The string to measure. - * @returns The unicode width of the string. - * - * @example Calculating the unicode width of a string - * ```ts - * import { unicodeWidth } from "https://deno.land/std@$STD_VERSION/console/unicode_width.ts"; - * - * unicodeWidth("hello world"); // 11 - * unicodeWidth("天地玄黃宇宙洪荒"); // 16 - * unicodeWidth("fullwidth"); // 18 - * ``` - * - * @example Calculating the unicode width of a color-encoded string - * ```ts - * import { unicodeWidth } from "https://deno.land/std@$STD_VERSION/console/unicode_width.ts"; - * import { stripAnsiCode } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts"; - * - * unicodeWidth(stripAnsiCode("\x1b[36mголубой\x1b[39m")); // 7 - * unicodeWidth(stripAnsiCode("\x1b[31m紅色\x1b[39m")); // 4 - * unicodeWidth(stripAnsiCode("\x1B]8;;https://deno.land\x07🦕\x1B]8;;\x07")); // 2 - * ``` - * - * Use - * {@linkcode https://jsr.io/@std/fmt/doc/colors/~/stripAnsiCode | stripAnsiCode} - * to remove ANSI escape codes from a string before passing it to - * {@linkcode unicodeWidth}. - * - * @deprecated Use {@linkcode unicodeWidth} from `std/cli` instead. This will be - * removed once the Standard Library migrates to {@link https://jsr.io/ | JSR}. - */ -export function unicodeWidth(str: string): number { - return _unicodeWidth(str); -}