yansu 0.0.0-beta.1
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/README.md +1 -0
- package/bin.mjs +18 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +68 -0
- package/dist/dirs.d.mts +4 -0
- package/dist/dirs.mjs +6 -0
- package/dist/index.d.mts +78 -0
- package/dist/index.mjs +121 -0
- package/dist/nitro.json +15 -0
- package/dist/public/_nuxt/BHIHUtPz.js +4 -0
- package/dist/public/_nuxt/CCgOhniq.js +1 -0
- package/dist/public/_nuxt/CR6vfq1R.js +1 -0
- package/dist/public/_nuxt/DmxzK6E8.js +1 -0
- package/dist/public/_nuxt/builds/latest.json +1 -0
- package/dist/public/_nuxt/builds/meta/e9079134-f314-434b-b3a7-092c4a1e187d.json +1 -0
- package/dist/public/_nuxt/entry.DJ3VOi_0.css +1 -0
- package/dist/public/_nuxt/error-404.lC6KBLNm.css +1 -0
- package/dist/public/_nuxt/error-500.NtBcR2wE.css +1 -0
- package/dist/server/chunks/_/error-500.mjs +9 -0
- package/dist/server/chunks/build/_plugin-vue_export-helper-DjsbPc54.mjs +29 -0
- package/dist/server/chunks/build/client.precomputed.mjs +3 -0
- package/dist/server/chunks/build/error-404-Du0ot2hm.mjs +369 -0
- package/dist/server/chunks/build/error-500-Y3RUV6n2.mjs +73 -0
- package/dist/server/chunks/build/server.mjs +727 -0
- package/dist/server/chunks/nitro/nitro.mjs +5176 -0
- package/dist/server/chunks/routes/api/metadata.json.mjs +147 -0
- package/dist/server/chunks/routes/api/platform.json.mjs +20 -0
- package/dist/server/chunks/routes/renderer.mjs +408 -0
- package/dist/server/chunks/virtual/_virtual_spa-template.mjs +3 -0
- package/dist/server/index.mjs +9 -0
- package/dist/server/node_modules/.nitro/@vue/shared@3.5.25/dist/shared.cjs.prod.js +604 -0
- package/dist/server/node_modules/.nitro/@vue/shared@3.5.25/package.json +47 -0
- package/dist/server/node_modules/.nitro/@vue/shared@3.5.26/dist/shared.cjs.prod.js +604 -0
- package/dist/server/node_modules/.nitro/@vue/shared@3.5.26/package.json +47 -0
- package/dist/server/node_modules/@babel/parser/lib/index.js +14662 -0
- package/dist/server/node_modules/@babel/parser/package.json +50 -0
- package/dist/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6763 -0
- package/dist/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/dist/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
- package/dist/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/dist/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
- package/dist/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/dist/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1853 -0
- package/dist/server/node_modules/@vue/reactivity/package.json +55 -0
- package/dist/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6770 -0
- package/dist/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/dist/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1732 -0
- package/dist/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/dist/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +879 -0
- package/dist/server/node_modules/@vue/server-renderer/package.json +55 -0
- package/dist/server/node_modules/ansis/index.cjs +1 -0
- package/dist/server/node_modules/ansis/index.mjs +1 -0
- package/dist/server/node_modules/ansis/package.json +25 -0
- package/dist/server/node_modules/birpc/dist/index.mjs +173 -0
- package/dist/server/node_modules/birpc/package.json +56 -0
- package/dist/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/dist/server/node_modules/consola/dist/core.mjs +512 -0
- package/dist/server/node_modules/consola/dist/index.mjs +651 -0
- package/dist/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/dist/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/dist/server/node_modules/consola/package.json +136 -0
- package/dist/server/node_modules/devalue/index.js +4 -0
- package/dist/server/node_modules/devalue/package.json +37 -0
- package/dist/server/node_modules/devalue/src/base64.js +110 -0
- package/dist/server/node_modules/devalue/src/constants.js +6 -0
- package/dist/server/node_modules/devalue/src/parse.js +205 -0
- package/dist/server/node_modules/devalue/src/stringify.js +265 -0
- package/dist/server/node_modules/devalue/src/uneval.js +407 -0
- package/dist/server/node_modules/devalue/src/utils.js +118 -0
- package/dist/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/dist/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/dist/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/dist/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/dist/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/dist/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/dist/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/dist/server/node_modules/entities/package.json +113 -0
- package/dist/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/dist/server/node_modules/estree-walker/package.json +37 -0
- package/dist/server/node_modules/get-port-please/dist/index.mjs +430 -0
- package/dist/server/node_modules/get-port-please/package.json +39 -0
- package/dist/server/node_modules/hookable/dist/index.mjs +290 -0
- package/dist/server/node_modules/hookable/package.json +49 -0
- package/dist/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/dist/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/dist/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/dist/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/dist/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/dist/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/dist/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/dist/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/dist/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/dist/server/node_modules/source-map-js/lib/util.js +594 -0
- package/dist/server/node_modules/source-map-js/package.json +71 -0
- package/dist/server/node_modules/source-map-js/source-map.js +8 -0
- package/dist/server/node_modules/structured-clone-es/dist/index.mjs +285 -0
- package/dist/server/node_modules/structured-clone-es/package.json +56 -0
- package/dist/server/node_modules/ufo/dist/index.mjs +638 -0
- package/dist/server/node_modules/ufo/package.json +47 -0
- package/dist/server/node_modules/unhead/dist/index.mjs +9 -0
- package/dist/server/node_modules/unhead/dist/parser.mjs +508 -0
- package/dist/server/node_modules/unhead/dist/plugins.mjs +101 -0
- package/dist/server/node_modules/unhead/dist/scripts.mjs +30 -0
- package/dist/server/node_modules/unhead/dist/server.mjs +182 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.B578PsDV.mjs +266 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.BPM0-cfG.mjs +44 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.BpRRHAhY.mjs +194 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +148 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.DH45uomy.mjs +180 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.DZbvapt-.mjs +70 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.Djo8ep_Y.mjs +166 -0
- package/dist/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
- package/dist/server/node_modules/unhead/dist/utils.mjs +5 -0
- package/dist/server/node_modules/unhead/package.json +105 -0
- package/dist/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/dist/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/dist/server/node_modules/vue/index.js +7 -0
- package/dist/server/node_modules/vue/index.mjs +1 -0
- package/dist/server/node_modules/vue/package.json +112 -0
- package/dist/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/dist/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +301 -0
- package/dist/server/node_modules/vue-bundle-renderer/package.json +55 -0
- package/dist/server/node_modules/ws/lib/buffer-util.js +131 -0
- package/dist/server/node_modules/ws/lib/constants.js +19 -0
- package/dist/server/node_modules/ws/lib/event-target.js +292 -0
- package/dist/server/node_modules/ws/lib/extension.js +203 -0
- package/dist/server/node_modules/ws/lib/limiter.js +55 -0
- package/dist/server/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/dist/server/node_modules/ws/lib/receiver.js +706 -0
- package/dist/server/node_modules/ws/lib/sender.js +602 -0
- package/dist/server/node_modules/ws/lib/stream.js +161 -0
- package/dist/server/node_modules/ws/lib/subprotocol.js +62 -0
- package/dist/server/node_modules/ws/lib/validation.js +152 -0
- package/dist/server/node_modules/ws/lib/websocket-server.js +554 -0
- package/dist/server/node_modules/ws/lib/websocket.js +1393 -0
- package/dist/server/node_modules/ws/package.json +69 -0
- package/dist/server/node_modules/ws/wrapper.mjs +8 -0
- package/dist/server/package.json +32 -0
- package/dist/shared/yansu.DmdNF4qf.mjs +151 -0
- package/package.json +50 -0
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
import { createConsola as createConsola$1, LogLevels } from './core.mjs';
|
|
2
|
+
export { Consola, LogTypes } from './core.mjs';
|
|
3
|
+
import { B as BasicReporter, p as parseStack } from './shared/consola.DRwqZj3T.mjs';
|
|
4
|
+
import g$1 from 'node:process';
|
|
5
|
+
import { e as colors, d as box, s as stripAnsi$1 } from './shared/consola.DXBYu-KD.mjs';
|
|
6
|
+
import 'node:util';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import 'node:tty';
|
|
9
|
+
|
|
10
|
+
const r=Object.create(null),i=e=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?r:globalThis),o=new Proxy(r,{get(e,s){return i()[s]??r[s]},has(e,s){const E=i();return s in E||s in r},set(e,s,E){const B=i(true);return B[s]=E,true},deleteProperty(e,s){if(!s)return false;const E=i(true);return delete E[s],true},ownKeys(){const e=i(true);return Object.keys(e)}}),t=typeof process<"u"&&process.env&&process.env.NODE_ENV||"",f=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:true}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:true}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:false}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:false}],["VERCEL","VERCEL_ENV",{ci:false}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:false}],["CODESANDBOX","CODESANDBOX_HOST",{ci:false}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:true}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:true}]];function b(){if(globalThis.process?.env)for(const e of f){const s=e[1]||e[0];if(globalThis.process?.env[s])return {name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:false}:{name:"",ci:false}}const l=b();l.name;function n(e){return e?e!=="false":false}const I=globalThis.process?.platform||"",T=n(o.CI)||l.ci!==false,a=n(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),g=n(o.DEBUG),R=t==="test"||n(o.TEST);n(o.MINIMAL)||T||R||!a;const A=/^win/i.test(I);!n(o.NO_COLOR)&&(n(o.FORCE_COLOR)||(a||A)&&o.TERM!=="dumb"||T);const C=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(C?.split(".")[0])||null;const y=globalThis.process||Object.create(null),_={versions:{}};new Proxy(y,{get(e,s){if(s==="env")return o;if(s in e)return e[s];if(s in _)return _[s]}});const c=globalThis.process?.release?.name==="node",O=!!globalThis.Bun||!!globalThis.process?.versions?.bun,D=!!globalThis.Deno,L=!!globalThis.fastly,S=!!globalThis.Netlify,u=!!globalThis.EdgeRuntime,N=globalThis.navigator?.userAgent==="Cloudflare-Workers",F=[[S,"netlify"],[u,"edge-light"],[N,"workerd"],[L,"fastly"],[D,"deno"],[O,"bun"],[c,"node"]];function G(){const e=F.find(s=>s[0]);if(e)return {name:e[1]}}const P=G();P?.name||"";
|
|
11
|
+
|
|
12
|
+
function ansiRegex({onlyFirst = false} = {}) {
|
|
13
|
+
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
14
|
+
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
|
15
|
+
const pattern = [
|
|
16
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
17
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
18
|
+
].join('|');
|
|
19
|
+
|
|
20
|
+
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const regex = ansiRegex();
|
|
24
|
+
|
|
25
|
+
function stripAnsi(string) {
|
|
26
|
+
if (typeof string !== 'string') {
|
|
27
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
31
|
+
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
32
|
+
// and doing it manually has a performance penalty.
|
|
33
|
+
return string.replace(regex, '');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Generated code.
|
|
37
|
+
|
|
38
|
+
function isAmbiguous(x) {
|
|
39
|
+
return x === 0xA1
|
|
40
|
+
|| x === 0xA4
|
|
41
|
+
|| x === 0xA7
|
|
42
|
+
|| x === 0xA8
|
|
43
|
+
|| x === 0xAA
|
|
44
|
+
|| x === 0xAD
|
|
45
|
+
|| x === 0xAE
|
|
46
|
+
|| x >= 0xB0 && x <= 0xB4
|
|
47
|
+
|| x >= 0xB6 && x <= 0xBA
|
|
48
|
+
|| x >= 0xBC && x <= 0xBF
|
|
49
|
+
|| x === 0xC6
|
|
50
|
+
|| x === 0xD0
|
|
51
|
+
|| x === 0xD7
|
|
52
|
+
|| x === 0xD8
|
|
53
|
+
|| x >= 0xDE && x <= 0xE1
|
|
54
|
+
|| x === 0xE6
|
|
55
|
+
|| x >= 0xE8 && x <= 0xEA
|
|
56
|
+
|| x === 0xEC
|
|
57
|
+
|| x === 0xED
|
|
58
|
+
|| x === 0xF0
|
|
59
|
+
|| x === 0xF2
|
|
60
|
+
|| x === 0xF3
|
|
61
|
+
|| x >= 0xF7 && x <= 0xFA
|
|
62
|
+
|| x === 0xFC
|
|
63
|
+
|| x === 0xFE
|
|
64
|
+
|| x === 0x101
|
|
65
|
+
|| x === 0x111
|
|
66
|
+
|| x === 0x113
|
|
67
|
+
|| x === 0x11B
|
|
68
|
+
|| x === 0x126
|
|
69
|
+
|| x === 0x127
|
|
70
|
+
|| x === 0x12B
|
|
71
|
+
|| x >= 0x131 && x <= 0x133
|
|
72
|
+
|| x === 0x138
|
|
73
|
+
|| x >= 0x13F && x <= 0x142
|
|
74
|
+
|| x === 0x144
|
|
75
|
+
|| x >= 0x148 && x <= 0x14B
|
|
76
|
+
|| x === 0x14D
|
|
77
|
+
|| x === 0x152
|
|
78
|
+
|| x === 0x153
|
|
79
|
+
|| x === 0x166
|
|
80
|
+
|| x === 0x167
|
|
81
|
+
|| x === 0x16B
|
|
82
|
+
|| x === 0x1CE
|
|
83
|
+
|| x === 0x1D0
|
|
84
|
+
|| x === 0x1D2
|
|
85
|
+
|| x === 0x1D4
|
|
86
|
+
|| x === 0x1D6
|
|
87
|
+
|| x === 0x1D8
|
|
88
|
+
|| x === 0x1DA
|
|
89
|
+
|| x === 0x1DC
|
|
90
|
+
|| x === 0x251
|
|
91
|
+
|| x === 0x261
|
|
92
|
+
|| x === 0x2C4
|
|
93
|
+
|| x === 0x2C7
|
|
94
|
+
|| x >= 0x2C9 && x <= 0x2CB
|
|
95
|
+
|| x === 0x2CD
|
|
96
|
+
|| x === 0x2D0
|
|
97
|
+
|| x >= 0x2D8 && x <= 0x2DB
|
|
98
|
+
|| x === 0x2DD
|
|
99
|
+
|| x === 0x2DF
|
|
100
|
+
|| x >= 0x300 && x <= 0x36F
|
|
101
|
+
|| x >= 0x391 && x <= 0x3A1
|
|
102
|
+
|| x >= 0x3A3 && x <= 0x3A9
|
|
103
|
+
|| x >= 0x3B1 && x <= 0x3C1
|
|
104
|
+
|| x >= 0x3C3 && x <= 0x3C9
|
|
105
|
+
|| x === 0x401
|
|
106
|
+
|| x >= 0x410 && x <= 0x44F
|
|
107
|
+
|| x === 0x451
|
|
108
|
+
|| x === 0x2010
|
|
109
|
+
|| x >= 0x2013 && x <= 0x2016
|
|
110
|
+
|| x === 0x2018
|
|
111
|
+
|| x === 0x2019
|
|
112
|
+
|| x === 0x201C
|
|
113
|
+
|| x === 0x201D
|
|
114
|
+
|| x >= 0x2020 && x <= 0x2022
|
|
115
|
+
|| x >= 0x2024 && x <= 0x2027
|
|
116
|
+
|| x === 0x2030
|
|
117
|
+
|| x === 0x2032
|
|
118
|
+
|| x === 0x2033
|
|
119
|
+
|| x === 0x2035
|
|
120
|
+
|| x === 0x203B
|
|
121
|
+
|| x === 0x203E
|
|
122
|
+
|| x === 0x2074
|
|
123
|
+
|| x === 0x207F
|
|
124
|
+
|| x >= 0x2081 && x <= 0x2084
|
|
125
|
+
|| x === 0x20AC
|
|
126
|
+
|| x === 0x2103
|
|
127
|
+
|| x === 0x2105
|
|
128
|
+
|| x === 0x2109
|
|
129
|
+
|| x === 0x2113
|
|
130
|
+
|| x === 0x2116
|
|
131
|
+
|| x === 0x2121
|
|
132
|
+
|| x === 0x2122
|
|
133
|
+
|| x === 0x2126
|
|
134
|
+
|| x === 0x212B
|
|
135
|
+
|| x === 0x2153
|
|
136
|
+
|| x === 0x2154
|
|
137
|
+
|| x >= 0x215B && x <= 0x215E
|
|
138
|
+
|| x >= 0x2160 && x <= 0x216B
|
|
139
|
+
|| x >= 0x2170 && x <= 0x2179
|
|
140
|
+
|| x === 0x2189
|
|
141
|
+
|| x >= 0x2190 && x <= 0x2199
|
|
142
|
+
|| x === 0x21B8
|
|
143
|
+
|| x === 0x21B9
|
|
144
|
+
|| x === 0x21D2
|
|
145
|
+
|| x === 0x21D4
|
|
146
|
+
|| x === 0x21E7
|
|
147
|
+
|| x === 0x2200
|
|
148
|
+
|| x === 0x2202
|
|
149
|
+
|| x === 0x2203
|
|
150
|
+
|| x === 0x2207
|
|
151
|
+
|| x === 0x2208
|
|
152
|
+
|| x === 0x220B
|
|
153
|
+
|| x === 0x220F
|
|
154
|
+
|| x === 0x2211
|
|
155
|
+
|| x === 0x2215
|
|
156
|
+
|| x === 0x221A
|
|
157
|
+
|| x >= 0x221D && x <= 0x2220
|
|
158
|
+
|| x === 0x2223
|
|
159
|
+
|| x === 0x2225
|
|
160
|
+
|| x >= 0x2227 && x <= 0x222C
|
|
161
|
+
|| x === 0x222E
|
|
162
|
+
|| x >= 0x2234 && x <= 0x2237
|
|
163
|
+
|| x === 0x223C
|
|
164
|
+
|| x === 0x223D
|
|
165
|
+
|| x === 0x2248
|
|
166
|
+
|| x === 0x224C
|
|
167
|
+
|| x === 0x2252
|
|
168
|
+
|| x === 0x2260
|
|
169
|
+
|| x === 0x2261
|
|
170
|
+
|| x >= 0x2264 && x <= 0x2267
|
|
171
|
+
|| x === 0x226A
|
|
172
|
+
|| x === 0x226B
|
|
173
|
+
|| x === 0x226E
|
|
174
|
+
|| x === 0x226F
|
|
175
|
+
|| x === 0x2282
|
|
176
|
+
|| x === 0x2283
|
|
177
|
+
|| x === 0x2286
|
|
178
|
+
|| x === 0x2287
|
|
179
|
+
|| x === 0x2295
|
|
180
|
+
|| x === 0x2299
|
|
181
|
+
|| x === 0x22A5
|
|
182
|
+
|| x === 0x22BF
|
|
183
|
+
|| x === 0x2312
|
|
184
|
+
|| x >= 0x2460 && x <= 0x24E9
|
|
185
|
+
|| x >= 0x24EB && x <= 0x254B
|
|
186
|
+
|| x >= 0x2550 && x <= 0x2573
|
|
187
|
+
|| x >= 0x2580 && x <= 0x258F
|
|
188
|
+
|| x >= 0x2592 && x <= 0x2595
|
|
189
|
+
|| x === 0x25A0
|
|
190
|
+
|| x === 0x25A1
|
|
191
|
+
|| x >= 0x25A3 && x <= 0x25A9
|
|
192
|
+
|| x === 0x25B2
|
|
193
|
+
|| x === 0x25B3
|
|
194
|
+
|| x === 0x25B6
|
|
195
|
+
|| x === 0x25B7
|
|
196
|
+
|| x === 0x25BC
|
|
197
|
+
|| x === 0x25BD
|
|
198
|
+
|| x === 0x25C0
|
|
199
|
+
|| x === 0x25C1
|
|
200
|
+
|| x >= 0x25C6 && x <= 0x25C8
|
|
201
|
+
|| x === 0x25CB
|
|
202
|
+
|| x >= 0x25CE && x <= 0x25D1
|
|
203
|
+
|| x >= 0x25E2 && x <= 0x25E5
|
|
204
|
+
|| x === 0x25EF
|
|
205
|
+
|| x === 0x2605
|
|
206
|
+
|| x === 0x2606
|
|
207
|
+
|| x === 0x2609
|
|
208
|
+
|| x === 0x260E
|
|
209
|
+
|| x === 0x260F
|
|
210
|
+
|| x === 0x261C
|
|
211
|
+
|| x === 0x261E
|
|
212
|
+
|| x === 0x2640
|
|
213
|
+
|| x === 0x2642
|
|
214
|
+
|| x === 0x2660
|
|
215
|
+
|| x === 0x2661
|
|
216
|
+
|| x >= 0x2663 && x <= 0x2665
|
|
217
|
+
|| x >= 0x2667 && x <= 0x266A
|
|
218
|
+
|| x === 0x266C
|
|
219
|
+
|| x === 0x266D
|
|
220
|
+
|| x === 0x266F
|
|
221
|
+
|| x === 0x269E
|
|
222
|
+
|| x === 0x269F
|
|
223
|
+
|| x === 0x26BF
|
|
224
|
+
|| x >= 0x26C6 && x <= 0x26CD
|
|
225
|
+
|| x >= 0x26CF && x <= 0x26D3
|
|
226
|
+
|| x >= 0x26D5 && x <= 0x26E1
|
|
227
|
+
|| x === 0x26E3
|
|
228
|
+
|| x === 0x26E8
|
|
229
|
+
|| x === 0x26E9
|
|
230
|
+
|| x >= 0x26EB && x <= 0x26F1
|
|
231
|
+
|| x === 0x26F4
|
|
232
|
+
|| x >= 0x26F6 && x <= 0x26F9
|
|
233
|
+
|| x === 0x26FB
|
|
234
|
+
|| x === 0x26FC
|
|
235
|
+
|| x === 0x26FE
|
|
236
|
+
|| x === 0x26FF
|
|
237
|
+
|| x === 0x273D
|
|
238
|
+
|| x >= 0x2776 && x <= 0x277F
|
|
239
|
+
|| x >= 0x2B56 && x <= 0x2B59
|
|
240
|
+
|| x >= 0x3248 && x <= 0x324F
|
|
241
|
+
|| x >= 0xE000 && x <= 0xF8FF
|
|
242
|
+
|| x >= 0xFE00 && x <= 0xFE0F
|
|
243
|
+
|| x === 0xFFFD
|
|
244
|
+
|| x >= 0x1F100 && x <= 0x1F10A
|
|
245
|
+
|| x >= 0x1F110 && x <= 0x1F12D
|
|
246
|
+
|| x >= 0x1F130 && x <= 0x1F169
|
|
247
|
+
|| x >= 0x1F170 && x <= 0x1F18D
|
|
248
|
+
|| x === 0x1F18F
|
|
249
|
+
|| x === 0x1F190
|
|
250
|
+
|| x >= 0x1F19B && x <= 0x1F1AC
|
|
251
|
+
|| x >= 0xE0100 && x <= 0xE01EF
|
|
252
|
+
|| x >= 0xF0000 && x <= 0xFFFFD
|
|
253
|
+
|| x >= 0x100000 && x <= 0x10FFFD;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function isFullWidth(x) {
|
|
257
|
+
return x === 0x3000
|
|
258
|
+
|| x >= 0xFF01 && x <= 0xFF60
|
|
259
|
+
|| x >= 0xFFE0 && x <= 0xFFE6;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function isWide(x) {
|
|
263
|
+
return x >= 0x1100 && x <= 0x115F
|
|
264
|
+
|| x === 0x231A
|
|
265
|
+
|| x === 0x231B
|
|
266
|
+
|| x === 0x2329
|
|
267
|
+
|| x === 0x232A
|
|
268
|
+
|| x >= 0x23E9 && x <= 0x23EC
|
|
269
|
+
|| x === 0x23F0
|
|
270
|
+
|| x === 0x23F3
|
|
271
|
+
|| x === 0x25FD
|
|
272
|
+
|| x === 0x25FE
|
|
273
|
+
|| x === 0x2614
|
|
274
|
+
|| x === 0x2615
|
|
275
|
+
|| x >= 0x2630 && x <= 0x2637
|
|
276
|
+
|| x >= 0x2648 && x <= 0x2653
|
|
277
|
+
|| x === 0x267F
|
|
278
|
+
|| x >= 0x268A && x <= 0x268F
|
|
279
|
+
|| x === 0x2693
|
|
280
|
+
|| x === 0x26A1
|
|
281
|
+
|| x === 0x26AA
|
|
282
|
+
|| x === 0x26AB
|
|
283
|
+
|| x === 0x26BD
|
|
284
|
+
|| x === 0x26BE
|
|
285
|
+
|| x === 0x26C4
|
|
286
|
+
|| x === 0x26C5
|
|
287
|
+
|| x === 0x26CE
|
|
288
|
+
|| x === 0x26D4
|
|
289
|
+
|| x === 0x26EA
|
|
290
|
+
|| x === 0x26F2
|
|
291
|
+
|| x === 0x26F3
|
|
292
|
+
|| x === 0x26F5
|
|
293
|
+
|| x === 0x26FA
|
|
294
|
+
|| x === 0x26FD
|
|
295
|
+
|| x === 0x2705
|
|
296
|
+
|| x === 0x270A
|
|
297
|
+
|| x === 0x270B
|
|
298
|
+
|| x === 0x2728
|
|
299
|
+
|| x === 0x274C
|
|
300
|
+
|| x === 0x274E
|
|
301
|
+
|| x >= 0x2753 && x <= 0x2755
|
|
302
|
+
|| x === 0x2757
|
|
303
|
+
|| x >= 0x2795 && x <= 0x2797
|
|
304
|
+
|| x === 0x27B0
|
|
305
|
+
|| x === 0x27BF
|
|
306
|
+
|| x === 0x2B1B
|
|
307
|
+
|| x === 0x2B1C
|
|
308
|
+
|| x === 0x2B50
|
|
309
|
+
|| x === 0x2B55
|
|
310
|
+
|| x >= 0x2E80 && x <= 0x2E99
|
|
311
|
+
|| x >= 0x2E9B && x <= 0x2EF3
|
|
312
|
+
|| x >= 0x2F00 && x <= 0x2FD5
|
|
313
|
+
|| x >= 0x2FF0 && x <= 0x2FFF
|
|
314
|
+
|| x >= 0x3001 && x <= 0x303E
|
|
315
|
+
|| x >= 0x3041 && x <= 0x3096
|
|
316
|
+
|| x >= 0x3099 && x <= 0x30FF
|
|
317
|
+
|| x >= 0x3105 && x <= 0x312F
|
|
318
|
+
|| x >= 0x3131 && x <= 0x318E
|
|
319
|
+
|| x >= 0x3190 && x <= 0x31E5
|
|
320
|
+
|| x >= 0x31EF && x <= 0x321E
|
|
321
|
+
|| x >= 0x3220 && x <= 0x3247
|
|
322
|
+
|| x >= 0x3250 && x <= 0xA48C
|
|
323
|
+
|| x >= 0xA490 && x <= 0xA4C6
|
|
324
|
+
|| x >= 0xA960 && x <= 0xA97C
|
|
325
|
+
|| x >= 0xAC00 && x <= 0xD7A3
|
|
326
|
+
|| x >= 0xF900 && x <= 0xFAFF
|
|
327
|
+
|| x >= 0xFE10 && x <= 0xFE19
|
|
328
|
+
|| x >= 0xFE30 && x <= 0xFE52
|
|
329
|
+
|| x >= 0xFE54 && x <= 0xFE66
|
|
330
|
+
|| x >= 0xFE68 && x <= 0xFE6B
|
|
331
|
+
|| x >= 0x16FE0 && x <= 0x16FE4
|
|
332
|
+
|| x === 0x16FF0
|
|
333
|
+
|| x === 0x16FF1
|
|
334
|
+
|| x >= 0x17000 && x <= 0x187F7
|
|
335
|
+
|| x >= 0x18800 && x <= 0x18CD5
|
|
336
|
+
|| x >= 0x18CFF && x <= 0x18D08
|
|
337
|
+
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
|
338
|
+
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
|
339
|
+
|| x === 0x1AFFD
|
|
340
|
+
|| x === 0x1AFFE
|
|
341
|
+
|| x >= 0x1B000 && x <= 0x1B122
|
|
342
|
+
|| x === 0x1B132
|
|
343
|
+
|| x >= 0x1B150 && x <= 0x1B152
|
|
344
|
+
|| x === 0x1B155
|
|
345
|
+
|| x >= 0x1B164 && x <= 0x1B167
|
|
346
|
+
|| x >= 0x1B170 && x <= 0x1B2FB
|
|
347
|
+
|| x >= 0x1D300 && x <= 0x1D356
|
|
348
|
+
|| x >= 0x1D360 && x <= 0x1D376
|
|
349
|
+
|| x === 0x1F004
|
|
350
|
+
|| x === 0x1F0CF
|
|
351
|
+
|| x === 0x1F18E
|
|
352
|
+
|| x >= 0x1F191 && x <= 0x1F19A
|
|
353
|
+
|| x >= 0x1F200 && x <= 0x1F202
|
|
354
|
+
|| x >= 0x1F210 && x <= 0x1F23B
|
|
355
|
+
|| x >= 0x1F240 && x <= 0x1F248
|
|
356
|
+
|| x === 0x1F250
|
|
357
|
+
|| x === 0x1F251
|
|
358
|
+
|| x >= 0x1F260 && x <= 0x1F265
|
|
359
|
+
|| x >= 0x1F300 && x <= 0x1F320
|
|
360
|
+
|| x >= 0x1F32D && x <= 0x1F335
|
|
361
|
+
|| x >= 0x1F337 && x <= 0x1F37C
|
|
362
|
+
|| x >= 0x1F37E && x <= 0x1F393
|
|
363
|
+
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
|
364
|
+
|| x >= 0x1F3CF && x <= 0x1F3D3
|
|
365
|
+
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
|
366
|
+
|| x === 0x1F3F4
|
|
367
|
+
|| x >= 0x1F3F8 && x <= 0x1F43E
|
|
368
|
+
|| x === 0x1F440
|
|
369
|
+
|| x >= 0x1F442 && x <= 0x1F4FC
|
|
370
|
+
|| x >= 0x1F4FF && x <= 0x1F53D
|
|
371
|
+
|| x >= 0x1F54B && x <= 0x1F54E
|
|
372
|
+
|| x >= 0x1F550 && x <= 0x1F567
|
|
373
|
+
|| x === 0x1F57A
|
|
374
|
+
|| x === 0x1F595
|
|
375
|
+
|| x === 0x1F596
|
|
376
|
+
|| x === 0x1F5A4
|
|
377
|
+
|| x >= 0x1F5FB && x <= 0x1F64F
|
|
378
|
+
|| x >= 0x1F680 && x <= 0x1F6C5
|
|
379
|
+
|| x === 0x1F6CC
|
|
380
|
+
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
|
381
|
+
|| x >= 0x1F6D5 && x <= 0x1F6D7
|
|
382
|
+
|| x >= 0x1F6DC && x <= 0x1F6DF
|
|
383
|
+
|| x === 0x1F6EB
|
|
384
|
+
|| x === 0x1F6EC
|
|
385
|
+
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
|
386
|
+
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
|
387
|
+
|| x === 0x1F7F0
|
|
388
|
+
|| x >= 0x1F90C && x <= 0x1F93A
|
|
389
|
+
|| x >= 0x1F93C && x <= 0x1F945
|
|
390
|
+
|| x >= 0x1F947 && x <= 0x1F9FF
|
|
391
|
+
|| x >= 0x1FA70 && x <= 0x1FA7C
|
|
392
|
+
|| x >= 0x1FA80 && x <= 0x1FA89
|
|
393
|
+
|| x >= 0x1FA8F && x <= 0x1FAC6
|
|
394
|
+
|| x >= 0x1FACE && x <= 0x1FADC
|
|
395
|
+
|| x >= 0x1FADF && x <= 0x1FAE9
|
|
396
|
+
|| x >= 0x1FAF0 && x <= 0x1FAF8
|
|
397
|
+
|| x >= 0x20000 && x <= 0x2FFFD
|
|
398
|
+
|| x >= 0x30000 && x <= 0x3FFFD;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function validate(codePoint) {
|
|
402
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
403
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
408
|
+
validate(codePoint);
|
|
409
|
+
|
|
410
|
+
if (
|
|
411
|
+
isFullWidth(codePoint)
|
|
412
|
+
|| isWide(codePoint)
|
|
413
|
+
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
414
|
+
) {
|
|
415
|
+
return 2;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return 1;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const emojiRegex = () => {
|
|
422
|
+
// https://mths.be/emoji
|
|
423
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split('') };
|
|
427
|
+
|
|
428
|
+
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
429
|
+
|
|
430
|
+
function stringWidth$1(string, options = {}) {
|
|
431
|
+
if (typeof string !== 'string' || string.length === 0) {
|
|
432
|
+
return 0;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const {
|
|
436
|
+
ambiguousIsNarrow = true,
|
|
437
|
+
countAnsiEscapeCodes = false,
|
|
438
|
+
} = options;
|
|
439
|
+
|
|
440
|
+
if (!countAnsiEscapeCodes) {
|
|
441
|
+
string = stripAnsi(string);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (string.length === 0) {
|
|
445
|
+
return 0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
let width = 0;
|
|
449
|
+
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
|
450
|
+
|
|
451
|
+
for (const {segment: character} of segmenter.segment(string)) {
|
|
452
|
+
const codePoint = character.codePointAt(0);
|
|
453
|
+
|
|
454
|
+
// Ignore control characters
|
|
455
|
+
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Ignore zero-width characters
|
|
460
|
+
if (
|
|
461
|
+
(codePoint >= 0x20_0B && codePoint <= 0x20_0F) // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
|
462
|
+
|| codePoint === 0xFE_FF // Zero-width no-break space
|
|
463
|
+
) {
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Ignore combining characters
|
|
468
|
+
if (
|
|
469
|
+
(codePoint >= 0x3_00 && codePoint <= 0x3_6F) // Combining diacritical marks
|
|
470
|
+
|| (codePoint >= 0x1A_B0 && codePoint <= 0x1A_FF) // Combining diacritical marks extended
|
|
471
|
+
|| (codePoint >= 0x1D_C0 && codePoint <= 0x1D_FF) // Combining diacritical marks supplement
|
|
472
|
+
|| (codePoint >= 0x20_D0 && codePoint <= 0x20_FF) // Combining diacritical marks for symbols
|
|
473
|
+
|| (codePoint >= 0xFE_20 && codePoint <= 0xFE_2F) // Combining half marks
|
|
474
|
+
) {
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Ignore surrogate pairs
|
|
479
|
+
if (codePoint >= 0xD8_00 && codePoint <= 0xDF_FF) {
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// Ignore variation selectors
|
|
484
|
+
if (codePoint >= 0xFE_00 && codePoint <= 0xFE_0F) {
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// This covers some of the above cases, but we still keep them for performance reasons.
|
|
489
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// TODO: Use `/\p{RGI_Emoji}/v` when targeting Node.js 20.
|
|
494
|
+
if (emojiRegex().test(character)) {
|
|
495
|
+
width += 2;
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
return width;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
function isUnicodeSupported() {
|
|
506
|
+
const {env} = g$1;
|
|
507
|
+
const {TERM, TERM_PROGRAM} = env;
|
|
508
|
+
|
|
509
|
+
if (g$1.platform !== 'win32') {
|
|
510
|
+
return TERM !== 'linux'; // Linux console (kernel)
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return Boolean(env.WT_SESSION) // Windows Terminal
|
|
514
|
+
|| Boolean(env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
|
|
515
|
+
|| env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
|
|
516
|
+
|| TERM_PROGRAM === 'Terminus-Sublime'
|
|
517
|
+
|| TERM_PROGRAM === 'vscode'
|
|
518
|
+
|| TERM === 'xterm-256color'
|
|
519
|
+
|| TERM === 'alacritty'
|
|
520
|
+
|| TERM === 'rxvt-unicode'
|
|
521
|
+
|| TERM === 'rxvt-unicode-256color'
|
|
522
|
+
|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
const TYPE_COLOR_MAP = {
|
|
526
|
+
info: "cyan",
|
|
527
|
+
fail: "red",
|
|
528
|
+
success: "green",
|
|
529
|
+
ready: "green",
|
|
530
|
+
start: "magenta"
|
|
531
|
+
};
|
|
532
|
+
const LEVEL_COLOR_MAP = {
|
|
533
|
+
0: "red",
|
|
534
|
+
1: "yellow"
|
|
535
|
+
};
|
|
536
|
+
const unicode = isUnicodeSupported();
|
|
537
|
+
const s = (c, fallback) => unicode ? c : fallback;
|
|
538
|
+
const TYPE_ICONS = {
|
|
539
|
+
error: s("\u2716", "\xD7"),
|
|
540
|
+
fatal: s("\u2716", "\xD7"),
|
|
541
|
+
ready: s("\u2714", "\u221A"),
|
|
542
|
+
warn: s("\u26A0", "\u203C"),
|
|
543
|
+
info: s("\u2139", "i"),
|
|
544
|
+
success: s("\u2714", "\u221A"),
|
|
545
|
+
debug: s("\u2699", "D"),
|
|
546
|
+
trace: s("\u2192", "\u2192"),
|
|
547
|
+
fail: s("\u2716", "\xD7"),
|
|
548
|
+
start: s("\u25D0", "o"),
|
|
549
|
+
log: ""
|
|
550
|
+
};
|
|
551
|
+
function stringWidth(str) {
|
|
552
|
+
const hasICU = typeof Intl === "object";
|
|
553
|
+
if (!hasICU || !Intl.Segmenter) {
|
|
554
|
+
return stripAnsi$1(str).length;
|
|
555
|
+
}
|
|
556
|
+
return stringWidth$1(str);
|
|
557
|
+
}
|
|
558
|
+
class FancyReporter extends BasicReporter {
|
|
559
|
+
formatStack(stack, message, opts) {
|
|
560
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
561
|
+
return `
|
|
562
|
+
${indent}` + parseStack(stack, message).map(
|
|
563
|
+
(line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)
|
|
564
|
+
).join(`
|
|
565
|
+
${indent}`);
|
|
566
|
+
}
|
|
567
|
+
formatType(logObj, isBadge, opts) {
|
|
568
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
569
|
+
if (isBadge) {
|
|
570
|
+
return getBgColor(typeColor)(
|
|
571
|
+
colors.black(` ${logObj.type.toUpperCase()} `)
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
575
|
+
return _type ? getColor(typeColor)(_type) : "";
|
|
576
|
+
}
|
|
577
|
+
formatLogObj(logObj, opts) {
|
|
578
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
579
|
+
"\n"
|
|
580
|
+
);
|
|
581
|
+
if (logObj.type === "box") {
|
|
582
|
+
return box(
|
|
583
|
+
characterFormat(
|
|
584
|
+
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
|
|
585
|
+
),
|
|
586
|
+
{
|
|
587
|
+
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
588
|
+
style: logObj.style
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
const date = this.formatDate(logObj.date, opts);
|
|
593
|
+
const coloredDate = date && colors.gray(date);
|
|
594
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
595
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
596
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
597
|
+
let line;
|
|
598
|
+
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
599
|
+
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
600
|
+
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
601
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
602
|
+
line += characterFormat(
|
|
603
|
+
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
|
604
|
+
);
|
|
605
|
+
if (logObj.type === "trace") {
|
|
606
|
+
const _err = new Error("Trace: " + logObj.message);
|
|
607
|
+
line += this.formatStack(_err.stack || "", _err.message);
|
|
608
|
+
}
|
|
609
|
+
return isBadge ? "\n" + line + "\n" : line;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function characterFormat(str) {
|
|
613
|
+
return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
|
|
614
|
+
}
|
|
615
|
+
function getColor(color = "white") {
|
|
616
|
+
return colors[color] || colors.white;
|
|
617
|
+
}
|
|
618
|
+
function getBgColor(color = "bgWhite") {
|
|
619
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function createConsola(options = {}) {
|
|
623
|
+
let level = _getDefaultLogLevel();
|
|
624
|
+
if (process.env.CONSOLA_LEVEL) {
|
|
625
|
+
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
626
|
+
}
|
|
627
|
+
const consola2 = createConsola$1({
|
|
628
|
+
level,
|
|
629
|
+
defaults: { level },
|
|
630
|
+
stdout: process.stdout,
|
|
631
|
+
stderr: process.stderr,
|
|
632
|
+
prompt: (...args) => import('./chunks/prompt.mjs').then((m) => m.prompt(...args)),
|
|
633
|
+
reporters: options.reporters || [
|
|
634
|
+
options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
|
|
635
|
+
],
|
|
636
|
+
...options
|
|
637
|
+
});
|
|
638
|
+
return consola2;
|
|
639
|
+
}
|
|
640
|
+
function _getDefaultLogLevel() {
|
|
641
|
+
if (g) {
|
|
642
|
+
return LogLevels.debug;
|
|
643
|
+
}
|
|
644
|
+
if (R) {
|
|
645
|
+
return LogLevels.warn;
|
|
646
|
+
}
|
|
647
|
+
return LogLevels.info;
|
|
648
|
+
}
|
|
649
|
+
const consola = createConsola();
|
|
650
|
+
|
|
651
|
+
export { LogLevels, consola, createConsola, consola as default };
|