@alexlit/lint-kit 190.0.1 → 191.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/config-eslint/package.json +3 -3
- package/packages/config-markdownlint/package.json +2 -2
- package/packages/config-markdownlint/node_modules/ansi-regex/index.d.ts +0 -33
- package/packages/config-markdownlint/node_modules/ansi-regex/index.js +0 -14
- package/packages/config-markdownlint/node_modules/ansi-regex/license +0 -9
- package/packages/config-markdownlint/node_modules/ansi-regex/package.json +0 -61
- package/packages/config-markdownlint/node_modules/ansi-regex/readme.md +0 -66
- package/packages/config-markdownlint/node_modules/markdownlint/CHANGELOG.md +0 -529
- package/packages/config-markdownlint/node_modules/markdownlint/CONTRIBUTING.md +0 -92
- package/packages/config-markdownlint/node_modules/markdownlint/LICENSE +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/README.md +0 -1112
- package/packages/config-markdownlint/node_modules/markdownlint/doc/CustomRules.md +0 -194
- package/packages/config-markdownlint/node_modules/markdownlint/doc/Prettier.md +0 -27
- package/packages/config-markdownlint/node_modules/markdownlint/doc/ReleaseProcess.md +0 -20
- package/packages/config-markdownlint/node_modules/markdownlint/doc/Rules.md +0 -2858
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md001.md +0 -51
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md003.md +0 -59
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md004.md +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md005.md +0 -53
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md007.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md009.md +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md010.md +0 -62
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md011.md +0 -30
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md012.md +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md013.md +0 -58
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md014.md +0 -54
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md018.md +0 -27
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md019.md +0 -28
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md020.md +0 -29
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md021.md +0 -31
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md022.md +0 -67
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md023.md +0 -33
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md024.md +0 -44
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md025.md +0 -49
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md026.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md027.md +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md028.md +0 -44
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md029.md +0 -100
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md030.md +0 -82
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md031.md +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md032.md +0 -55
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md033.md +0 -33
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md034.md +0 -55
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md035.md +0 -44
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md036.md +0 -45
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md037.md +0 -37
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md038.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md039.md +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md040.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md041.md +0 -64
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md042.md +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md043.md +0 -87
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md044.md +0 -45
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md045.md +0 -48
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md046.md +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md047.md +0 -34
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md048.md +0 -42
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md049.md +0 -36
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md050.md +0 -35
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md051.md +0 -117
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md052.md +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md053.md +0 -38
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md054.md +0 -100
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md055.md +0 -55
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md056.md +0 -37
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md058.md +0 -48
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md059.md +0 -33
- package/packages/config-markdownlint/node_modules/markdownlint/doc/md060.md +0 -130
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/LICENSE +0 -21
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/README.md +0 -29
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/helpers.cjs +0 -695
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/micromark-helpers.cjs +0 -332
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/package.json +0 -26
- package/packages/config-markdownlint/node_modules/markdownlint/helpers/shared.cjs +0 -16
- package/packages/config-markdownlint/node_modules/markdownlint/lib/cache.mjs +0 -80
- package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration-strict.d.ts +0 -2417
- package/packages/config-markdownlint/node_modules/markdownlint/lib/configuration.d.ts +0 -8
- package/packages/config-markdownlint/node_modules/markdownlint/lib/constants.mjs +0 -14
- package/packages/config-markdownlint/node_modules/markdownlint/lib/defer-require.cjs +0 -18
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-async.d.mts +0 -1
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-async.mjs +0 -3
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-promise.d.mts +0 -1
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-promise.mjs +0 -3
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-sync.d.mts +0 -1
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports-sync.mjs +0 -3
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports.d.mts +0 -30
- package/packages/config-markdownlint/node_modules/markdownlint/lib/exports.mjs +0 -33
- package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownit.cjs +0 -171
- package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.d.mts +0 -615
- package/packages/config-markdownlint/node_modules/markdownlint/lib/markdownlint.mjs +0 -1592
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md001.mjs +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md003.mjs +0 -47
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md004.mjs +0 -72
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md005.mjs +0 -69
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md007.mjs +0 -84
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md009.mjs +0 -96
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md010.mjs +0 -78
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md011.mjs +0 -56
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md012.mjs +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md013.mjs +0 -91
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md014.mjs +0 -47
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md018.mjs +0 -43
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md019-md021.mjs +0 -77
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md020.mjs +0 -68
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md022.mjs +0 -103
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md023.mjs +0 -37
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md024.mjs +0 -45
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md025.mjs +0 -45
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md026.mjs +0 -46
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md027.mjs +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md028.mjs +0 -39
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md029.mjs +0 -84
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md030.mjs +0 -57
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md031.mjs +0 -61
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md032.mjs +0 -78
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md033.mjs +0 -46
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md034.mjs +0 -92
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md035.mjs +0 -23
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md036.mjs +0 -55
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md037.mjs +0 -94
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md038.mjs +0 -73
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md039.mjs +0 -59
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md040.mjs +0 -32
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md041.mjs +0 -71
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md042.mjs +0 -58
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md043.mjs +0 -72
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md044.mjs +0 -110
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md045.mjs +0 -61
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md046.mjs +0 -31
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md047.mjs +0 -28
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md048.mjs +0 -47
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md049-md050.mjs +0 -115
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md051.mjs +0 -173
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md052.mjs +0 -40
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md053.mjs +0 -60
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md054.mjs +0 -122
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md055.mjs +0 -72
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md056.mjs +0 -50
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md058.mjs +0 -57
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md059.mjs +0 -71
- package/packages/config-markdownlint/node_modules/markdownlint/lib/md060.mjs +0 -209
- package/packages/config-markdownlint/node_modules/markdownlint/lib/micromark-parse.mjs +0 -337
- package/packages/config-markdownlint/node_modules/markdownlint/lib/micromark-types.d.mts +0 -11
- package/packages/config-markdownlint/node_modules/markdownlint/lib/node-imports-browser.mjs +0 -22
- package/packages/config-markdownlint/node_modules/markdownlint/lib/node-imports-node.mjs +0 -11
- package/packages/config-markdownlint/node_modules/markdownlint/lib/parse-configuration.mjs +0 -47
- package/packages/config-markdownlint/node_modules/markdownlint/lib/resolve-module.cjs +0 -52
- package/packages/config-markdownlint/node_modules/markdownlint/lib/resolve-module.d.cts +0 -34
- package/packages/config-markdownlint/node_modules/markdownlint/lib/rules.mjs +0 -122
- package/packages/config-markdownlint/node_modules/markdownlint/lib/types.d.mts +0 -13
- package/packages/config-markdownlint/node_modules/markdownlint/package.json +0 -120
- package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.jsonc +0 -349
- package/packages/config-markdownlint/node_modules/markdownlint/schema/.markdownlint.yaml +0 -310
- package/packages/config-markdownlint/node_modules/markdownlint/schema/ValidatingConfiguration.md +0 -26
- package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema-strict.json +0 -5138
- package/packages/config-markdownlint/node_modules/markdownlint/schema/markdownlint-config-schema.json +0 -5143
- package/packages/config-markdownlint/node_modules/markdownlint/style/all.json +0 -5
- package/packages/config-markdownlint/node_modules/markdownlint/style/cirosantilli.json +0 -22
- package/packages/config-markdownlint/node_modules/markdownlint/style/prettier.json +0 -27
- package/packages/config-markdownlint/node_modules/markdownlint/style/relaxed.json +0 -12
- package/packages/config-markdownlint/node_modules/string-width/index.d.ts +0 -39
- package/packages/config-markdownlint/node_modules/string-width/index.js +0 -203
- package/packages/config-markdownlint/node_modules/string-width/license +0 -9
- package/packages/config-markdownlint/node_modules/string-width/package.json +0 -65
- package/packages/config-markdownlint/node_modules/string-width/readme.md +0 -66
- package/packages/config-markdownlint/node_modules/strip-ansi/index.d.ts +0 -15
- package/packages/config-markdownlint/node_modules/strip-ansi/index.js +0 -19
- package/packages/config-markdownlint/node_modules/strip-ansi/license +0 -9
- package/packages/config-markdownlint/node_modules/strip-ansi/package.json +0 -59
- package/packages/config-markdownlint/node_modules/strip-ansi/readme.md +0 -37
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"comment": "Rules for the style guide at https://www.cirosantilli.com/markdown-style-guide/",
|
|
3
|
-
|
|
4
|
-
"default": true,
|
|
5
|
-
"MD003": {
|
|
6
|
-
"style": "atx"
|
|
7
|
-
},
|
|
8
|
-
"MD004": {
|
|
9
|
-
"style": "dash"
|
|
10
|
-
},
|
|
11
|
-
"MD007": {
|
|
12
|
-
"indent": 4
|
|
13
|
-
},
|
|
14
|
-
"MD030": {
|
|
15
|
-
"ul_multi": 3,
|
|
16
|
-
"ol_multi": 2
|
|
17
|
-
},
|
|
18
|
-
"MD033": false,
|
|
19
|
-
"MD035": {
|
|
20
|
-
"style": "---"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"comment": "Disables rules that may conflict with Prettier",
|
|
3
|
-
|
|
4
|
-
"blanks-around-fences": false,
|
|
5
|
-
"blanks-around-headings": false,
|
|
6
|
-
"blanks-around-lists": false,
|
|
7
|
-
"code-fence-style": false,
|
|
8
|
-
"emphasis-style": false,
|
|
9
|
-
"heading-start-left": false,
|
|
10
|
-
"heading-style": false,
|
|
11
|
-
"hr-style": false,
|
|
12
|
-
"line-length": false,
|
|
13
|
-
"list-indent": false,
|
|
14
|
-
"list-marker-space": false,
|
|
15
|
-
"no-blanks-blockquote": false,
|
|
16
|
-
"no-hard-tabs": false,
|
|
17
|
-
"no-missing-space-atx": false,
|
|
18
|
-
"no-missing-space-closed-atx": false,
|
|
19
|
-
"no-multiple-blanks": false,
|
|
20
|
-
"no-multiple-space-atx": false,
|
|
21
|
-
"no-multiple-space-blockquote": false,
|
|
22
|
-
"no-multiple-space-closed-atx": false,
|
|
23
|
-
"no-trailing-spaces": false,
|
|
24
|
-
"ol-prefix": false,
|
|
25
|
-
"strong-style": false,
|
|
26
|
-
"ul-indent": false
|
|
27
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export type Options = {
|
|
2
|
-
/**
|
|
3
|
-
Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
|
|
4
|
-
|
|
5
|
-
@default true
|
|
6
|
-
|
|
7
|
-
> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). __If the context cannot be established reliably, they should be treated as narrow characters by default.__
|
|
8
|
-
> - http://www.unicode.org/reports/tr11/
|
|
9
|
-
*/
|
|
10
|
-
readonly ambiguousIsNarrow?: boolean;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
|
|
14
|
-
|
|
15
|
-
@default false
|
|
16
|
-
*/
|
|
17
|
-
readonly countAnsiEscapeCodes?: boolean;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
Get the visual width of a string - the number of columns required to display it.
|
|
22
|
-
|
|
23
|
-
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
|
24
|
-
|
|
25
|
-
@example
|
|
26
|
-
```
|
|
27
|
-
import stringWidth from 'string-width';
|
|
28
|
-
|
|
29
|
-
stringWidth('a');
|
|
30
|
-
//=> 1
|
|
31
|
-
|
|
32
|
-
stringWidth('古');
|
|
33
|
-
//=> 2
|
|
34
|
-
|
|
35
|
-
stringWidth('\u001B[1m古\u001B[22m');
|
|
36
|
-
//=> 2
|
|
37
|
-
```
|
|
38
|
-
*/
|
|
39
|
-
export default function stringWidth(string: string, options?: Options): number;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import stripAnsi from 'strip-ansi';
|
|
2
|
-
import {eastAsianWidth} from 'get-east-asian-width';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
Logic:
|
|
6
|
-
- Segment graphemes to match how terminals render clusters.
|
|
7
|
-
- Width rules:
|
|
8
|
-
1. Skip non-printing clusters (Default_Ignorable, Control, pure Mark, lone Surrogates). Tabs are ignored by design.
|
|
9
|
-
2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
|
|
10
|
-
3. Minimally-qualified/unqualified emoji clusters (ZWJ sequences with 2+ Extended_Pictographic, or keycap sequences) are double-width.
|
|
11
|
-
4. Hangul jamo collapse each standard modern Hangul L+V or L+V+T syllable piece to width 2.
|
|
12
|
-
Unmatched repeated leading/vowel/trailing jamo stay additive because that matches how the terminals we target render them.
|
|
13
|
-
5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const segmenter = new Intl.Segmenter();
|
|
17
|
-
|
|
18
|
-
// Whole-cluster zero-width
|
|
19
|
-
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v;
|
|
20
|
-
|
|
21
|
-
// Pick the base scalar if the cluster starts with Prepend/Format/Marks
|
|
22
|
-
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v;
|
|
23
|
-
|
|
24
|
-
// RGI emoji sequences
|
|
25
|
-
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
26
|
-
|
|
27
|
-
// Detect minimally-qualified/unqualified emoji sequences (missing VS16 but still render as double-width)
|
|
28
|
-
const unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
|
|
29
|
-
const extendedPictographicRegex = /\p{Extended_Pictographic}/gu;
|
|
30
|
-
|
|
31
|
-
function isDoubleWidthNonRgiEmojiSequence(segment) {
|
|
32
|
-
// Real emoji clusters are < 30 chars; guard against pathological input
|
|
33
|
-
if (segment.length > 50) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (unqualifiedKeycapRegex.test(segment)) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// ZWJ sequences with 2+ Extended_Pictographic
|
|
42
|
-
if (segment.includes('\u200D')) {
|
|
43
|
-
const pictographics = segment.match(extendedPictographicRegex);
|
|
44
|
-
return pictographics !== null && pictographics.length >= 2;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function baseVisible(segment) {
|
|
51
|
-
return segment.replace(leadingNonPrintingRegex, '');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function isZeroWidthCluster(segment) {
|
|
55
|
-
return zeroWidthClusterRegex.test(segment);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function isHangulLeadingJamo(codePoint) {
|
|
59
|
-
return (codePoint >= 0x11_00 && codePoint <= 0x11_5F)
|
|
60
|
-
|| (codePoint >= 0xA9_60 && codePoint <= 0xA9_7C);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function isHangulVowelJamo(codePoint) {
|
|
64
|
-
return (codePoint >= 0x11_60 && codePoint <= 0x11_A7)
|
|
65
|
-
|| (codePoint >= 0xD7_B0 && codePoint <= 0xD7_C6);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function isHangulTrailingJamo(codePoint) {
|
|
69
|
-
return (codePoint >= 0x11_A8 && codePoint <= 0x11_FF)
|
|
70
|
-
|| (codePoint >= 0xD7_CB && codePoint <= 0xD7_FB);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function isHangulJamo(codePoint) {
|
|
74
|
-
return isHangulLeadingJamo(codePoint)
|
|
75
|
-
|| isHangulVowelJamo(codePoint)
|
|
76
|
-
|| isHangulTrailingJamo(codePoint);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
80
|
-
const codePoints = [];
|
|
81
|
-
|
|
82
|
-
for (const character of visibleSegment) {
|
|
83
|
-
if (zeroWidthClusterRegex.test(character)) {
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
codePoints.push(character.codePointAt(0));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (codePoints.length === 0) {
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let width = 0;
|
|
95
|
-
|
|
96
|
-
for (let index = 0; index < codePoints.length; index++) {
|
|
97
|
-
const codePoint = codePoints[index];
|
|
98
|
-
if (!isHangulJamo(codePoint)) {
|
|
99
|
-
if (width === 0) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Mixed cluster (e.g., L + precomposed syllable): use EAW for non-jamo remainder
|
|
104
|
-
for (let remaining = index; remaining < codePoints.length; remaining++) {
|
|
105
|
-
width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return width;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Modern Hangul L+V(+T) shapes as one syllable block. Unmatched jamo stay additive:
|
|
112
|
-
// U+1100 U+1100 U+1161 => U+1100 + (U+1100 U+1161) => 2 + 2.
|
|
113
|
-
if (
|
|
114
|
-
isHangulLeadingJamo(codePoint)
|
|
115
|
-
&& isHangulVowelJamo(codePoints[index + 1])
|
|
116
|
-
) {
|
|
117
|
-
width += 2;
|
|
118
|
-
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return width;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions) {
|
|
129
|
-
let extra = 0;
|
|
130
|
-
let first = true;
|
|
131
|
-
|
|
132
|
-
for (const character of visibleSegment) {
|
|
133
|
-
if (first) {
|
|
134
|
-
first = false;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (character >= '\uFF00' && character <= '\uFFEF') {
|
|
139
|
-
extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return extra;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export default function stringWidth(input, options = {}) {
|
|
147
|
-
if (typeof input !== 'string' || input.length === 0) {
|
|
148
|
-
return 0;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const {
|
|
152
|
-
ambiguousIsNarrow = true,
|
|
153
|
-
countAnsiEscapeCodes = false,
|
|
154
|
-
} = options;
|
|
155
|
-
|
|
156
|
-
let string = input;
|
|
157
|
-
|
|
158
|
-
// Avoid calling stripAnsi when there are no ANSI escape sequences (ESC = 0x1B, CSI = 0x9B)
|
|
159
|
-
if (!countAnsiEscapeCodes && (string.includes('\u001B') || string.includes('\u009B'))) {
|
|
160
|
-
string = stripAnsi(string);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (string.length === 0) {
|
|
164
|
-
return 0;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Fast path: printable ASCII (0x20–0x7E) needs no segmenter, regex, or EAW lookup — width equals length.
|
|
168
|
-
if (/^[\u0020-\u007E]*$/.test(string)) {
|
|
169
|
-
return string.length;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
let width = 0;
|
|
173
|
-
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
|
174
|
-
|
|
175
|
-
for (const {segment} of segmenter.segment(string)) {
|
|
176
|
-
// Zero-width / non-printing clusters
|
|
177
|
-
if (isZeroWidthCluster(segment)) {
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Emoji width logic
|
|
182
|
-
if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
|
|
183
|
-
width += 2;
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const visibleSegment = baseVisible(segment);
|
|
188
|
-
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
189
|
-
if (hangulWidth !== undefined) {
|
|
190
|
-
width += hangulWidth;
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Everything else: EAW of the cluster’s first visible scalar
|
|
195
|
-
const codePoint = visibleSegment.codePointAt(0);
|
|
196
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
197
|
-
|
|
198
|
-
// Add width for trailing Halfwidth and Fullwidth Forms (e.g., ゙, ゚, ー)
|
|
199
|
-
width += trailingHalfwidthWidth(visibleSegment, eastAsianWidthOptions);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return width;
|
|
203
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "string-width",
|
|
3
|
-
"version": "8.2.1",
|
|
4
|
-
"description": "Get the visual width of a string - the number of columns required to display it",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/string-width",
|
|
7
|
-
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": {
|
|
15
|
-
"types": "./index.d.ts",
|
|
16
|
-
"default": "./index.js"
|
|
17
|
-
},
|
|
18
|
-
"sideEffects": false,
|
|
19
|
-
"engines": {
|
|
20
|
-
"node": ">=20"
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"test": "xo && ava && tsd"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
"index.js",
|
|
27
|
-
"index.d.ts"
|
|
28
|
-
],
|
|
29
|
-
"keywords": [
|
|
30
|
-
"string",
|
|
31
|
-
"character",
|
|
32
|
-
"unicode",
|
|
33
|
-
"width",
|
|
34
|
-
"visual",
|
|
35
|
-
"column",
|
|
36
|
-
"columns",
|
|
37
|
-
"fullwidth",
|
|
38
|
-
"full-width",
|
|
39
|
-
"wcwidth",
|
|
40
|
-
"wcswidth",
|
|
41
|
-
"full",
|
|
42
|
-
"ansi",
|
|
43
|
-
"escape",
|
|
44
|
-
"codes",
|
|
45
|
-
"cli",
|
|
46
|
-
"command-line",
|
|
47
|
-
"terminal",
|
|
48
|
-
"console",
|
|
49
|
-
"cjk",
|
|
50
|
-
"chinese",
|
|
51
|
-
"japanese",
|
|
52
|
-
"korean",
|
|
53
|
-
"fixed-width",
|
|
54
|
-
"east-asian-width"
|
|
55
|
-
],
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"get-east-asian-width": "^1.5.0",
|
|
58
|
-
"strip-ansi": "^7.1.2"
|
|
59
|
-
},
|
|
60
|
-
"devDependencies": {
|
|
61
|
-
"ava": "^6.4.1",
|
|
62
|
-
"tsd": "^0.33.0",
|
|
63
|
-
"xo": "^1.2.3"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# string-width
|
|
2
|
-
|
|
3
|
-
> Get the visual width of a string - the number of columns required to display it
|
|
4
|
-
|
|
5
|
-
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and do not affect the width.
|
|
6
|
-
|
|
7
|
-
Useful to be able to measure the actual width of command-line output.
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
npm install string-width
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
import stringWidth from 'string-width';
|
|
19
|
-
|
|
20
|
-
stringWidth('a');
|
|
21
|
-
//=> 1
|
|
22
|
-
|
|
23
|
-
stringWidth('古');
|
|
24
|
-
//=> 2
|
|
25
|
-
|
|
26
|
-
stringWidth('\u001B[1m古\u001B[22m');
|
|
27
|
-
//=> 2
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## API
|
|
31
|
-
|
|
32
|
-
### stringWidth(string, options?)
|
|
33
|
-
|
|
34
|
-
#### string
|
|
35
|
-
|
|
36
|
-
Type: `string`
|
|
37
|
-
|
|
38
|
-
The string to be counted.
|
|
39
|
-
|
|
40
|
-
#### options
|
|
41
|
-
|
|
42
|
-
Type: `object`
|
|
43
|
-
|
|
44
|
-
##### ambiguousIsNarrow
|
|
45
|
-
|
|
46
|
-
Type: `boolean`\
|
|
47
|
-
Default: `true`
|
|
48
|
-
|
|
49
|
-
Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
|
|
50
|
-
|
|
51
|
-
> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). **If the context cannot be established reliably, they should be treated as narrow characters by default.**
|
|
52
|
-
> - http://www.unicode.org/reports/tr11/
|
|
53
|
-
|
|
54
|
-
##### countAnsiEscapeCodes
|
|
55
|
-
|
|
56
|
-
Type: `boolean`\
|
|
57
|
-
Default: `false`
|
|
58
|
-
|
|
59
|
-
Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
|
|
60
|
-
|
|
61
|
-
## Related
|
|
62
|
-
|
|
63
|
-
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
|
|
64
|
-
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
|
|
65
|
-
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
|
|
66
|
-
- [get-east-asian-width](https://github.com/sindresorhus/get-east-asian-width) - Determine the East Asian Width of a Unicode character
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
|
3
|
-
|
|
4
|
-
@example
|
|
5
|
-
```
|
|
6
|
-
import stripAnsi from 'strip-ansi';
|
|
7
|
-
|
|
8
|
-
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
|
9
|
-
//=> 'Unicorn'
|
|
10
|
-
|
|
11
|
-
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
|
12
|
-
//=> 'Click'
|
|
13
|
-
```
|
|
14
|
-
*/
|
|
15
|
-
export default function stripAnsi(string: string): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import ansiRegex from 'ansi-regex';
|
|
2
|
-
|
|
3
|
-
const regex = ansiRegex();
|
|
4
|
-
|
|
5
|
-
export default function stripAnsi(string) {
|
|
6
|
-
if (typeof string !== 'string') {
|
|
7
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer
|
|
11
|
-
if (!string.includes('\u001B') && !string.includes('\u009B')) {
|
|
12
|
-
return string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
16
|
-
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
17
|
-
// and doing it manually has a performance penalty.
|
|
18
|
-
return string.replace(regex, '');
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "strip-ansi",
|
|
3
|
-
"version": "7.2.0",
|
|
4
|
-
"description": "Strip ANSI escape codes from a string",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "chalk/strip-ansi",
|
|
7
|
-
"funding": "https://github.com/chalk/strip-ansi?sponsor=1",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": "./index.js",
|
|
15
|
-
"types": "./index.d.ts",
|
|
16
|
-
"sideEffects": false,
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=12"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "xo && ava && tsd"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"index.js",
|
|
25
|
-
"index.d.ts"
|
|
26
|
-
],
|
|
27
|
-
"keywords": [
|
|
28
|
-
"strip",
|
|
29
|
-
"trim",
|
|
30
|
-
"remove",
|
|
31
|
-
"ansi",
|
|
32
|
-
"styles",
|
|
33
|
-
"color",
|
|
34
|
-
"colour",
|
|
35
|
-
"colors",
|
|
36
|
-
"terminal",
|
|
37
|
-
"console",
|
|
38
|
-
"string",
|
|
39
|
-
"tty",
|
|
40
|
-
"escape",
|
|
41
|
-
"formatting",
|
|
42
|
-
"rgb",
|
|
43
|
-
"256",
|
|
44
|
-
"shell",
|
|
45
|
-
"xterm",
|
|
46
|
-
"log",
|
|
47
|
-
"logging",
|
|
48
|
-
"command-line",
|
|
49
|
-
"text"
|
|
50
|
-
],
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"ansi-regex": "^6.2.2"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"ava": "^6.4.1",
|
|
56
|
-
"tsd": "^0.33.0",
|
|
57
|
-
"xo": "^1.2.3"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# strip-ansi
|
|
2
|
-
|
|
3
|
-
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
|
|
4
|
-
|
|
5
|
-
> [!NOTE]
|
|
6
|
-
> Node.js has this built-in now with [`stripVTControlCharacters`](https://nodejs.org/api/util.html#utilstripvtcontrolcharactersstr). The benefit of this package is consistent behavior across Node.js versions and faster improvements. The Node.js version is actually based on this package.
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
npm install strip-ansi
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
import stripAnsi from 'strip-ansi';
|
|
18
|
-
|
|
19
|
-
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
|
20
|
-
//=> 'Unicorn'
|
|
21
|
-
|
|
22
|
-
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
|
23
|
-
//=> 'Click'
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Related
|
|
27
|
-
|
|
28
|
-
- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
|
|
29
|
-
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module
|
|
30
|
-
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
|
31
|
-
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
|
32
|
-
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
|
33
|
-
|
|
34
|
-
## Maintainers
|
|
35
|
-
|
|
36
|
-
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
37
|
-
- [Josh Junon](https://github.com/qix-)
|