@visulima/string 3.1.0 → 3.1.2
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/CHANGELOG.md +24 -0
- package/LICENSE.md +81 -129
- package/README.md +3 -3
- package/dist/align-text.js +2 -2
- package/dist/case/camel-case.d.ts +2 -2
- package/dist/case/camel-case.js +1 -1
- package/dist/case/capital-case.d.ts +2 -2
- package/dist/case/capital-case.js +1 -1
- package/dist/case/constant-case.d.ts +2 -2
- package/dist/case/constant-case.js +1 -1
- package/dist/case/dot-case.d.ts +2 -2
- package/dist/case/dot-case.js +1 -1
- package/dist/case/flat-case.d.ts +2 -2
- package/dist/case/flat-case.js +1 -1
- package/dist/case/flip-case.d.ts +2 -2
- package/dist/case/flip-case.js +1 -1
- package/dist/case/identify-case.d.ts +2 -2
- package/dist/case/identify-case.js +1 -1
- package/dist/case/index.d.ts +2 -2
- package/dist/case/index.js +1 -1
- package/dist/case/kebab-case.d.ts +2 -2
- package/dist/case/kebab-case.js +1 -1
- package/dist/case/lower-first.d.ts +2 -2
- package/dist/case/lower-first.js +1 -1
- package/dist/case/no-case.d.ts +2 -2
- package/dist/case/no-case.js +1 -1
- package/dist/case/pascal-case.d.ts +2 -2
- package/dist/case/pascal-case.js +1 -1
- package/dist/case/pascal-snake-case.d.ts +2 -2
- package/dist/case/pascal-snake-case.js +1 -1
- package/dist/case/path-case.d.ts +2 -2
- package/dist/case/path-case.js +1 -1
- package/dist/case/sentence-case.d.ts +2 -2
- package/dist/case/sentence-case.js +1 -1
- package/dist/case/snake-case.d.ts +2 -2
- package/dist/case/snake-case.js +1 -1
- package/dist/case/split-by-case.d.ts +2 -2
- package/dist/case/split-by-case.js +1 -1
- package/dist/case/title-case.d.ts +2 -2
- package/dist/case/title-case.js +1 -1
- package/dist/case/train-case.d.ts +2 -2
- package/dist/case/train-case.js +1 -1
- package/dist/case/upper-first.d.ts +2 -2
- package/dist/case/upper-first.js +1 -1
- package/dist/closest-string.js +1 -1
- package/dist/compare-similarity.js +1 -1
- package/dist/count-occurrences.js +1 -1
- package/dist/direction.js +1 -1
- package/dist/east-asian-width.d.ts +5 -1
- package/dist/east-asian-width.js +1 -1
- package/dist/excerpt.js +55 -44
- package/dist/get-string-truncated-width.js +1 -1
- package/dist/indent.d.ts +3 -1
- package/dist/indent.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/is-fullwidth-code-point.js +1 -1
- package/dist/levenshtein.js +1 -1
- package/dist/native-string-types.d.ts +6 -1
- package/dist/outdent.js +1 -1
- package/dist/packem_shared/{_isFullWidth-Dqc3MWgl.js → _isFullWidth-dWWDw5Is.js} +1 -1
- package/dist/packem_shared/ansi-state-tracker-BFhXTS-5.js +1 -0
- package/dist/packem_shared/closest-CSX4px2F.js +1 -0
- package/dist/packem_shared/constants-BGGeBKGT.js +1 -0
- package/dist/packem_shared/dedent-CDXp3nZQ.js +1 -0
- package/dist/packem_shared/eastAsianWidth-DACe9Ds2.js +1 -0
- package/dist/packem_shared/generate-cache-key-th9N8-CB.js +1 -0
- package/dist/packem_shared/indent-CY079Qyq.js +1 -0
- package/dist/packem_shared/joinSegments-9qx7xSy7.js +1 -0
- package/dist/packem_shared/{lru-cache-BtMSrYQJ.js → lru-cache-BD25OaEQ.js} +1 -1
- package/dist/packem_shared/normalize-german-eszett-DtW4F-Wg.js +1 -0
- package/dist/packem_shared/redent-lctoaAtw.js +1 -0
- package/dist/packem_shared/{strip-vt-control-characters-BW1RglLp.js → strip-vt-control-characters-vMeu7uFw.js} +1 -1
- package/dist/packem_shared/{types.d-CMNqA5bi.d.ts → types.d-BdJ2aEyS.d.ts} +1 -1
- package/dist/packem_shared/{types.d-LgsTR37y.d.ts → types.d-Bky9TnxG.d.ts} +6 -1
- package/dist/replace-string.d.ts +1 -1
- package/dist/replace-string.js +1 -1
- package/dist/slice.js +1 -1
- package/dist/slugify.d.ts +1 -1
- package/dist/slugify.js +1 -1
- package/dist/test/utils.js +10 -10
- package/dist/transliterate.d.ts +1 -1
- package/dist/transliterate.js +3 -3
- package/dist/truncate.js +1 -1
- package/dist/utilities.d.ts +1 -1
- package/dist/utilities.js +1 -1
- package/dist/word-similarity-sort.js +1 -1
- package/dist/word-wrap.js +5 -7
- package/package.json +2 -2
- package/dist/packem_shared/closest-C6YDQs4m.js +0 -1
- package/dist/packem_shared/constants-aPzGW29R.js +0 -1
- package/dist/packem_shared/dedent-CPjAYUXh.js +0 -1
- package/dist/packem_shared/eastAsianWidth-DJV8Kqd-.js +0 -1
- package/dist/packem_shared/generate-cache-key-B_0X7MKm.js +0 -1
- package/dist/packem_shared/indent-cz8WMI0e.js +0 -1
- package/dist/packem_shared/joinSegments-CaHT-45s.js +0 -1
- package/dist/packem_shared/normalize-german-eszett-hNMwtGjd.js +0 -1
- package/dist/packem_shared/redent-ByOoJ6fN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{eastAsianWidthType as
|
|
1
|
+
import{eastAsianWidthType as R}from"./packem_shared/eastAsianWidth-DACe9Ds2.js";import{R as j,a as S,b as g}from"./packem_shared/constants-BGGeBKGT.js";const N=new Map,p=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),F=t=>{const i=p(t.width);let a=N.get(i);return a||(a=new Map,N.set(i,a)),a},I=new RegExp(S.source,"y"),E=new RegExp(j.source,"uy"),x=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,_=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Y=(t,i)=>{const a=F(i),h=Math.floor(t/65536),w=t%65536;let f=a.get(h);if(f||(f=new Map,a.set(h,f)),f.has(w))return f.get(w);let r;switch(_(t)){case"control":{r=i.width.control;break}case"latin":{r=i.width.regular;break}case"wide":{r=i.width.wide;break}case"zero":{r=0;break}default:switch(R(t)){case"ambiguous":{r=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{r=i.width.fullWidth;break}case"wide":{r=i.width.wide;break}default:r=i.width.regular}}return f.set(w,r),r},z=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,O=(t,i={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const a={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?O(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},h=Math.max(0,a.truncation.limit-a.truncation.ellipsisWidth),{length:w}=t,f=w>1e4;let r=0,e=0,s=w,u=!1;const A=t.includes("\x1B")||t.includes("");for(;r<w;){if(A&&(t[r]==="\x1B"||t[r]==="")){if(t.startsWith("\x1B]8;;",r)){const l="\x1B]8;;\x07",b=l.length,c=t.indexOf("\x07",r+5);if(c!==-1){const k=t.indexOf(l,c+1);if(k!==-1){const y=k+b,B=t.slice(c+1,k).replace(S,""),M=O(B,{ambiguousIsNarrow:a.width.ambiguousIsNarrow,ansiWidth:a.width.ansi,controlWidth:a.width.control,countAnsiEscapeCodes:!1,ellipsis:a.truncation.ellipsis,ellipsisWidth:a.truncation.ellipsisWidth,emojiWidth:a.width.emoji,fullWidth:a.width.fullWidth,halfWidth:a.width.halfWidth,limit:Math.max(0,h-e),regularWidth:a.width.regular,tabWidth:a.width.tab,wideWidth:a.width.wide}),C=M.width;if(M.truncated)u=!0,s=Math.min(s,r);else if(e+C>h&&(s=Math.min(s,r),u=!0,e+C>a.truncation.limit))break;if(e+=C,r=y,u&&e>=a.truncation.limit)break;continue}}}if(I.lastIndex=r,I.test(t)){const W=I.lastIndex-r,l=a.truncation.countAnsiEscapeCodes?W:a.width.ansi;if(e+l>h&&(s=Math.min(s,r),e+l>a.truncation.limit)){u=!0;break}e+=l,r=I.lastIndex;continue}}const m=t.codePointAt(r);if(m===8203||m===65279||m>=8288&&m<=8292){r+=1;continue}if(m===9){if(e+a.width.tab>h&&(s=Math.min(s,r),e+a.width.tab>a.truncation.limit)){u=!0;break}e+=a.width.tab,r+=1;continue}if(x.lastIndex=r,x.test(t)){const l=(x.lastIndex-r)*a.width.regular;if(e+l>h){const b=a.width.regular>0?Math.floor((h-e)/a.width.regular):0;if(s=Math.min(s,r+b),e+l>a.truncation.limit){u=!0;break}}e+=l,r=x.lastIndex;continue}if((m<=31||m>=127&&m<=159)&&(g.lastIndex=r,g.test(t))){const l=(g.lastIndex-r)*a.width.control;if(e+l>h){const b=a.width.control>0?Math.floor((h-e)/a.width.control):0;if(s=Math.min(s,r+b),e+l>a.truncation.limit){u=!0;break}}e+=l,r=g.lastIndex;continue}if(E.lastIndex=r,E.test(t)){if(e+a.width.emoji>h&&(s=Math.min(s,r),e+a.width.emoji>a.truncation.limit)){u=!0;break}e+=a.width.emoji,r=E.lastIndex;continue}const d=t.codePointAt(r)??0;if(z(d)){r+=d>65535?2:1;continue}let n;if(f)n=Y(d,a);else switch(_(d)){case"control":{n=a.width.control;break}case"latin":{n=a.width.regular;break}case"wide":{n=a.width.wide;break}case"zero":{n=0;break}default:switch(R(d)){case"ambiguous":{n=a.width.ambiguousIsNarrow?a.width.regular:a.width.wide;break}case"fullwidth":{n=a.width.fullWidth;break}case"wide":{n=a.width.wide;break}default:n=a.width.regular}}if(e+n>h&&(s=Math.min(s,r),e+n>a.truncation.limit)){u=!0;break}e+=n,r+=d>65535?2:1}let T=e,L=!1;return u&&a.truncation.limit>=a.truncation.ellipsisWidth&&(T=a.truncation.limit,L=!0),{ellipsed:L,index:u?s:w,truncated:u,width:T}};export{O as getStringTruncatedWidth};
|
package/dist/indent.d.ts
CHANGED
|
@@ -85,4 +85,6 @@ dedent(`
|
|
|
85
85
|
```
|
|
86
86
|
*/
|
|
87
87
|
declare function dedent(string: string): string;
|
|
88
|
-
export {
|
|
88
|
+
export {
|
|
89
|
+
|
|
90
|
+
type Options as IndentOptions, dedent, indentString as indent, redent, stripIndent };
|
package/dist/indent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as d}from"./packem_shared/indent-
|
|
1
|
+
import{default as d}from"./packem_shared/indent-CY079Qyq.js";import{default as a}from"./packem_shared/redent-lctoaAtw.js";import{dedent as n,default as o}from"./packem_shared/dedent-CDXp3nZQ.js";export{n as dedent,d as indent,a as redent,o as stripIndent};
|
package/dist/index.d.ts
CHANGED
|
@@ -17,18 +17,16 @@ export { default as snakeCase } from "./case/snake-case.js";
|
|
|
17
17
|
export { type SplitOptions, splitByCase } from "./case/split-by-case.js";
|
|
18
18
|
export { default as titleCase } from "./case/title-case.js";
|
|
19
19
|
export { default as trainCase } from "./case/train-case.js";
|
|
20
|
-
export type { C as CamelCase, a as CapitalCase, b as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from "./packem_shared/types.d-
|
|
20
|
+
export type { C as CamelCase, a as CapitalCase, b as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from "./packem_shared/types.d-BdJ2aEyS.js";
|
|
21
21
|
export { default as upperFirst } from "./case/upper-first.js";
|
|
22
22
|
export { joinSegments } from "./case/index.js";
|
|
23
23
|
export { type ClosestStringOptions, closestString } from "./closest-string.js";
|
|
24
24
|
export { type CompareSimilarityOptions, compareSimilarity } from "./compare-similarity.js";
|
|
25
25
|
export { countOccurrences } from "./count-occurrences.js";
|
|
26
26
|
export { direction } from "./direction.js";
|
|
27
|
-
export { type EastAsianWidthOptions, type EastAsianWidthType, eastAsianWidth, eastAsianWidthType } from "./east-asian-width.js";
|
|
28
27
|
export { type ExcerptOptions, excerpt } from "./excerpt.js";
|
|
29
28
|
export { type StringTruncatedWidthOptions, type StringTruncatedWidthResult, getStringTruncatedWidth } from "./get-string-truncated-width.js";
|
|
30
29
|
export { type StringWidthOptions, getStringWidth } from "./get-string-width.js";
|
|
31
|
-
export { type IndentOptions, dedent, indent, redent, stripIndent } from "./indent.js";
|
|
32
30
|
export { default as isFullwidthCodePoint } from "./is-fullwidth-code-point.js";
|
|
33
31
|
export { closest, closestN, distance, similarity } from "./levenshtein.js";
|
|
34
32
|
export { type Outdent, type Options as OutdentOptions, outdent } from "./outdent.js";
|
|
@@ -37,7 +35,9 @@ export { type SliceOptions, slice } from "./slice.js";
|
|
|
37
35
|
export { default as slugify } from "./slugify.js";
|
|
38
36
|
export { default as transliterate } from "./transliterate.js";
|
|
39
37
|
export { type TruncateOptions, truncate } from "./truncate.js";
|
|
40
|
-
export type { A as All, a as Any, C as CharAt, b as Charmap, c as Concat, E as EndsWith, I as Includes, d as Interval, e as IntervalArray, f as IsBooleanLiteral, g as IsNumberLiteral, h as IsStringLiteral, i as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, O as OptionReplaceArray, j as OptionReplaceCombined, k as OptionReplaceObject, l as OptionsTransliterate, P as PadEnd, m as PadStart, R as Repeat, n as Replace, o as ReplaceAll, p as Reverse, S as Slice, q as SlugifyOptions, r as Split, s as StartsWith, T as ToLowerCase, t as ToUpperCase, u as Trim, v as TrimEnd, w as TrimStart } from "./packem_shared/types.d-
|
|
38
|
+
export type { A as All, a as Any, C as CharAt, b as Charmap, c as Concat, E as EndsWith, I as Includes, d as Interval, e as IntervalArray, f as IsBooleanLiteral, g as IsNumberLiteral, h as IsStringLiteral, i as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, O as OptionReplaceArray, j as OptionReplaceCombined, k as OptionReplaceObject, l as OptionsTransliterate, P as PadEnd, m as PadStart, R as Repeat, n as Replace, o as ReplaceAll, p as Reverse, S as Slice, q as SlugifyOptions, r as Split, s as StartsWith, T as ToLowerCase, t as ToUpperCase, u as Trim, v as TrimEnd, w as TrimStart } from "./packem_shared/types.d-Bky9TnxG.js";
|
|
41
39
|
export { escapeRegExp, findStringOccurrences, hasChinese, hasPunctuationOrSpace, inRange } from "./utilities.js";
|
|
42
40
|
export { type WordSimilaritySortOptions, wordSimilaritySort } from "./word-similarity-sort.js";
|
|
43
41
|
export { type WordWrapOptions, WrapMode, wordWrap } from "./word-wrap.js";
|
|
42
|
+
export { type EastAsianWidthOptions, type EastAsianWidthType, eastAsianWidth, eastAsianWidthType } from "./east-asian-width.js";
|
|
43
|
+
export { type IndentOptions, dedent, indent, redent, stripIndent } from "./indent.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{alignText as r}from"./align-text.js";import{default as a}from"./case/camel-case.js";import{default as s}from"./case/capital-case.js";import{default as m}from"./case/constant-case.js";import{default as i}from"./case/dot-case.js";import{default as d}from"./case/flat-case.js";import{flipCase as u}from"./case/flip-case.js";import{default as C}from"./case/identify-case.js";import{kebabCase as S}from"./case/kebab-case.js";import{default as y}from"./case/lower-first.js";import{default as w}from"./case/no-case.js";import{default as F}from"./case/pascal-case.js";import{default as T}from"./case/pascal-snake-case.js";import{default as A}from"./case/path-case.js";import{default as R}from"./case/sentence-case.js";import{default as B}from"./case/snake-case.js";import{splitByCase as I}from"./case/split-by-case.js";import{default as N}from"./case/title-case.js";import{default as v}from"./case/train-case.js";import{default as D}from"./case/upper-first.js";import{default as H}from"./packem_shared/joinSegments-
|
|
1
|
+
import{alignText as r}from"./align-text.js";import{default as a}from"./case/camel-case.js";import{default as s}from"./case/capital-case.js";import{default as m}from"./case/constant-case.js";import{default as i}from"./case/dot-case.js";import{default as d}from"./case/flat-case.js";import{flipCase as u}from"./case/flip-case.js";import{default as C}from"./case/identify-case.js";import{kebabCase as S}from"./case/kebab-case.js";import{default as y}from"./case/lower-first.js";import{default as w}from"./case/no-case.js";import{default as F}from"./case/pascal-case.js";import{default as T}from"./case/pascal-snake-case.js";import{default as A}from"./case/path-case.js";import{default as R}from"./case/sentence-case.js";import{default as B}from"./case/snake-case.js";import{splitByCase as I}from"./case/split-by-case.js";import{default as N}from"./case/title-case.js";import{default as v}from"./case/train-case.js";import{default as D}from"./case/upper-first.js";import{default as H}from"./packem_shared/joinSegments-9qx7xSy7.js";import{closestString as K}from"./closest-string.js";import{compareSimilarity as Q}from"./compare-similarity.js";import{countOccurrences as V}from"./count-occurrences.js";import{direction as Y}from"./direction.js";import{excerpt as _}from"./excerpt.js";import{getStringTruncatedWidth as ee}from"./get-string-truncated-width.js";import{getStringWidth as re}from"./get-string-width.js";import{default as ae}from"./is-fullwidth-code-point.js";import{closestN as se,similarity as pe}from"./levenshtein.js";import{outdent as xe}from"./outdent.js";import{default as le}from"./replace-string.js";import{slice as ne}from"./slice.js";import{default as ce}from"./slugify.js";import{default as ge}from"./transliterate.js";import{truncate as he}from"./truncate.js";import{escapeRegExp as We,findStringOccurrences as we,hasChinese as ke,hasPunctuationOrSpace as Fe,inRange as Oe}from"./utilities.js";import{wordSimilaritySort as be}from"./word-similarity-sort.js";import{WrapMode as Pe,wordWrap as Re}from"./word-wrap.js";import{default as Be}from"./packem_shared/indent-CY079Qyq.js";import{default as Ie}from"./packem_shared/redent-lctoaAtw.js";import{dedent as Ne,default as qe}from"./packem_shared/dedent-CDXp3nZQ.js";import{closest as ze,distance as De}from"./packem_shared/closest-CSX4px2F.js";import{eastAsianWidth as He,eastAsianWidthType as Je}from"./packem_shared/eastAsianWidth-DACe9Ds2.js";export{Pe as WrapMode,r as alignText,a as camelCase,s as capitalCase,ze as closest,se as closestN,K as closestString,Q as compareSimilarity,m as constantCase,V as countOccurrences,Ne as dedent,Y as direction,De as distance,i as dotCase,He as eastAsianWidth,Je as eastAsianWidthType,We as escapeRegExp,_ as excerpt,we as findStringOccurrences,d as flatCase,u as flipCase,ee as getStringTruncatedWidth,re as getStringWidth,ke as hasChinese,Fe as hasPunctuationOrSpace,C as identifyCase,Oe as inRange,Be as indent,ae as isFullwidthCodePoint,H as joinSegments,S as kebabCase,y as lowerFirst,w as noCase,xe as outdent,F as pascalCase,T as pascalSnakeCase,A as pathCase,Ie as redent,le as replaceString,R as sentenceCase,pe as similarity,ne as slice,ce as slugify,B as snakeCase,I as splitByCase,qe as stripIndent,N as titleCase,v as trainCase,ge as transliterate,he as truncate,D as upperFirst,be as wordSimilaritySort,Re as wordWrap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isFullWidth as
|
|
1
|
+
import{isFullWidth as e,isWide as i}from"./packem_shared/_isFullWidth-dWWDw5Is.js";const s=r=>Number.isInteger(r)?e(r)||i(r):!1;export{s as default};
|
package/dist/levenshtein.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{distance as
|
|
1
|
+
import{distance as a}from"./packem_shared/closest-CSX4px2F.js";import{closest as x}from"./packem_shared/closest-CSX4px2F.js";const h=(r,n,e)=>{const o=Array.from({length:e}).fill(1/0),s=Array.from({length:e}).fill(void 0);for(const f of n){const c=f;let l=a(r,c),i=c;for(let t=0;t<e;t+=1)if(l<o[t]){const m=o[t],u=s[t];o[t]=l,s[t]=i,l=m,i=u}}return s},y=(r,n)=>{if(r===n)return 1;const e=Math.max(r.length,n.length);return e===0?1:1-a(r,n)/e};export{x as closest,h as closestN,a as distance,y as similarity};
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
* @returns A tuple type of length L filled with type T
|
|
8
8
|
*/
|
|
9
9
|
type TupleOf<L extends number, T = unknown, Result extends any[] = []> = Result["length"] extends L ? Result : TupleOf<L, T, [...Result, T]>;
|
|
10
|
+
/**
|
|
11
|
+
* Repeat counts whose literal expansion stays within TypeScript's instantiation depth limit.
|
|
12
|
+
*/
|
|
13
|
+
type SafeRepeatCount = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45;
|
|
10
14
|
/**
|
|
11
15
|
* Internal type for implementing string slicing with both start and end indices.
|
|
12
16
|
* Handles edge cases and type safety for string literal types.
|
|
@@ -165,13 +169,14 @@ type PadStart<T extends string, Times extends number = 0, Pad extends string = "
|
|
|
165
169
|
/**
|
|
166
170
|
* Type-level implementation of string.repeat() functionality.
|
|
167
171
|
* Creates a new string type by repeating the input string a specified number of times.
|
|
172
|
+
* Counts above 45 fall back to `string` to avoid TypeScript's type-instantiation depth limit (TS2589).
|
|
168
173
|
* @template T - The string type to repeat
|
|
169
174
|
* @template Times - The number of times to repeat the string
|
|
170
175
|
* @returns A string type containing T repeated Times times
|
|
171
176
|
* @example
|
|
172
177
|
* type Repeated = Repeat<'abc', 2> // type Repeated = 'abcabc'
|
|
173
178
|
*/
|
|
174
|
-
type Repeat<T extends string, Times extends number = 0> = All<[IsStringLiteral<T>, IsNumberLiteral<Times>]> extends true ? Times extends 0 ? "" : Math.IsNegative<Times> extends false ? Join<TupleOf<Times, T>> : never : string;
|
|
179
|
+
type Repeat<T extends string, Times extends number = 0> = T extends T ? All<[IsStringLiteral<T>, IsNumberLiteral<Times>]> extends true ? Times extends 0 ? "" : Math.IsNegative<Times> extends false ? Times extends SafeRepeatCount ? Join<TupleOf<Times, T>> : string : never : string : never;
|
|
175
180
|
/**
|
|
176
181
|
* Type-level implementation of string.replaceAll() functionality.
|
|
177
182
|
* Replaces all occurrences of a substring with another string.
|
package/dist/outdent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as S,g as w,h as L,i as m,j as R,k as W}from"./packem_shared/constants-BGGeBKGT.js";const _=(e,n)=>Object.hasOwn(e,n),N=(e,n)=>Object.assign(e,n),g=(e,n,t)=>{if(e.length===0)return[];let r=0;const i=R.exec(e[0]);i&&(r=i[1].length);const l=String.raw`(\r\n|\r|\n).{0,${r}}`,s=new RegExp(l,"g"),c=n?e.slice(1):e,{newline:E,trimLeadingNewline:I,trimTrailingNewline:d}=t,o=typeof E=="string",f=c.length,h=Array.from({length:f});for(let u=0;u<f;u++){let a=c[u];a=a.replace(s,"$1"),u===0&&I&&(a=a.replace(S,"")),u===f-1&&d&&(a=a.replace(w,"")),o&&(a=a.replaceAll(W,E)),h[u]=a}return h},O=(e,n)=>{const t=Array.from({length:e.length+n.length});let r=0;const i=e.length;for(;r<i-1;r++)t[r*2]=e[r],t[r*2+1]=String(n[r]);return t[r*2]=e[r],t.join("")},p=e=>_(e,"raw")&&_(e,"length"),x=new WeakMap,T=e=>{const n=e.cache!==!1,t=n?e.cacheStore??x:void 0,r=e.newline!==void 0;function i(l,...s){if(p(l)){const c=l,E=s.length;if(c.length===1&&c[0]==="")return"";if(E===0){if(n&&t&&!r){const h=t.get(c);if(h)return h[0]}const f=g(c,!1,e);return n&&t&&t.set(c,f),f[0]}const d=(s[0]===i||s[0]===A)&&L.test(c[0])&&m.test(c[1]);let o;return n&&t&&!r&&(o=t.get(c)),o||(o=g(c,d,e),n&&t&&t.set(c,o)),O(o,d?s.slice(1):s)}return T(N(N({},e),l))}return N(i,{string(l){return l===""||!l?"":g([l],!1,e)[0]}})},A=T({cache:!0,newline:null,trimLeadingNewline:!0,trimTrailingNewline:!0}),C=A;export{C as outdent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],f=12288,m=65510,h=[12288,12288,65281,65376,65504,65510],w=8361,d=65518,C=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],M=32,c=10630,g=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],x=4352,b=262141,o=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],e=(t,a)=>{let r=0,n=Math.floor(t.length/2)-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=i*2;if(a<t[s])n=i-1;else if(a>t[s+1])r=i+1;else return!0}return!1},u=19968,[R,F]=W(o);function W(t){let a=t[0],r=t[1];for(let n=0;n<t.length;n+=2){const i=t[n],s=t[n+1];if(u>=i&&u<=s)return[i,s];s-i>r-a&&(a=i,r=s)}return[a,r]}const E=t=>t<161||t>1114109?!1:e(l,t),S=t=>t<f||t>m?!1:e(h,t),j=t=>t<w||t>d?!1:e(C,t),k=t=>t<M||t>c?!1:e(g,t),p=t=>t>=R&&t<=F?!0:t<x||t>b?!1:e(o,t);function y(t){return E(t)?"ambiguous":S(t)?"fullwidth":j(t)?"halfwidth":k(t)?"narrow":p(t)?"wide":"neutral"}export{y as getCategory,E as isAmbiguous,S as isFullWidth,p as isWide};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const g=/^(?:\u001B\[|\u009B)([\d:;]*)m$/,c=new Map([[1,22],[2,22],[3,23],[4,24],[5,25],[6,25],[7,27],[8,28],[9,29],[21,24],[53,55]]),p=new Set(c.values()),l=i=>{const t=i.split(";"),e=[];for(let s=0;s<t.length;s+=1){const r=t[s];if(r.includes(":")){e.push([r]);continue}const o=r===""?0:Number.parseInt(r,10);if(o===38||o===48||o===58){const a=t[s+1];let n=0;a==="5"?n=2:a==="2"?n=4:a?.includes(":")&&(n=1),e.push(t.slice(s,s+1+n)),s+=n;continue}e.push([r])}return e},u=i=>{const t=i[0],e=t.indexOf(":"),s=e===-1?t:t.slice(0,e);return s===""?0:Number.parseInt(s,10)},v=i=>i===38||i>=30&&i<=37||i>=90&&i<=97,h=i=>i===48||i>=40&&i<=47||i>=100&&i<=107,d=i=>{const t=l(i);if(t.length!==1)return;const e=u(t[0]);return v(e)?"foreground":h(e)?"background":void 0};class f{activeForeground=void 0;activeBackground=void 0;activeUnderlineColor=void 0;activeAttributes=new Map;processEscape(t){const e=g.exec(t);if(e)for(const s of l(e[1])){const r=u(s);switch(r){case 0:{this.resetAll();break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}case 59:{this.activeUnderlineColor=void 0;break}default:this.applyParameter(r,`\x1B[${s.join(";")}m`)}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,this.activeUnderlineColor,...this.activeAttributes.values()].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[...this.activeAttributes.keys()].toReversed().map(e=>`\x1B[${String(e)}m`);return this.activeUnderlineColor&&t.push("\x1B[59m"),this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}resetAll(){this.activeForeground=void 0,this.activeBackground=void 0,this.activeUnderlineColor=void 0,this.activeAttributes.clear()}applyParameter(t,e){if(!((t===38||t===48||t===58)&&!e.includes(";")&&!e.includes(":")))if(v(t))this.activeForeground=e;else if(h(t))this.activeBackground=e;else if(t===58)this.activeUnderlineColor=e;else if(p.has(t))this.activeAttributes.delete(t);else{const s=c.get(t);s!==void 0&&this.activeAttributes.set(s,e)}}}export{f as A,d as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const g=new Uint32Array(65536),z=(n,o)=>{const l=n.length,h=o.length,r=1<<l-1;let c=-1,m=0,a=l,s=l;for(;s--;)g[n.charCodeAt(s)]|=1<<s;for(s=0;s<h;s++){let d=g[o.charCodeAt(s)];const v=d|m;d|=(d&c)+c^c,m|=~(d|c),c&=d,m&r&&a++,c&r&&a--,m=m<<1|1,c=c<<1|~(v|m),m&=v}for(s=l;s--;)g[n.charCodeAt(s)]=0;return a},j=(n,o)=>{const l=o.length,h=n.length,r=[],c=[],m=Math.ceil(l/32),a=Math.ceil(h/32);for(let t=0;t<m;t++)c[t]=-1,r[t]=0;let s=0;for(;s<a-1;s++){let t=0,i=-1;const C=s*32,A=Math.min(32,h)+C;for(let e=C;e<A;e++)g[n.charCodeAt(e)]|=1<<e;for(let e=0;e<l;e++){const x=g[o.charCodeAt(e)],p=c[e/32|0]>>>e&1,f=r[e/32|0]>>>e&1,_=x|t,w=((x|f)&i)+i^i|x|f;let u=t|~(w|i),q=i&w;u>>>31^p&&(c[e/32|0]^=1<<e),q>>>31^f&&(r[e/32|0]^=1<<e),u=u<<1|p,q=q<<1|f,i=q|~(_|u),t=u&_}for(let e=C;e<A;e++)g[n.charCodeAt(e)]=0}let d=0,v=-1;const k=s*32,M=Math.min(32,h-k)+k;for(let t=k;t<M;t++)g[n.charCodeAt(t)]|=1<<t;let y=h;for(let t=0;t<l;t++){const i=g[o.charCodeAt(t)],C=c[t/32|0]>>>t&1,A=r[t/32|0]>>>t&1,e=i|d,x=((i|A)&v)+v^v|i|A;let p=d|~(x|v),f=v&x;y+=p>>>h-1&1,y-=f>>>h-1&1,p>>>31^C&&(c[t/32|0]^=1<<t),f>>>31^A&&(r[t/32|0]^=1<<t),p=p<<1|C,f=f<<1|A,v=f|~(e|p),d=p&e}for(let t=k;t<M;t++)g[n.charCodeAt(t)]=0;return y},I=(n,o)=>{if(n.length<o.length){const l=o;o=n,n=l}return o.length===0?n.length:n.length<=32?z(n,o):j(n,o)},U=(n,o)=>{let l=1/0,h=0;for(let r=0;r<o.length;r++){const c=I(n,o[r]);c<l&&(l=c,h=r)}return o[h]};export{U as closest,I as distance};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=String.raw,E=n`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,t=()=>new RegExp(n`\p{RI}{2}|(?)${E}(?:\u200D${E})*`,"gu"),p=new Set(["\x1B",""]),a="\x07",c="]8;;",u=/[\u200B\uFEFF\u2060-\u2064]/g,e=/^[ \t]*(?:\r\n|\r|\n)/,_=/(?:\r\n|\r|\n)[ \t]*$/,r=/^(?:[\r\n]|$)/,A=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,o=/^[ \t]*[\r\n][ \t\r\n]*$/,S=/\r\n|\n|\r/g,i=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\)|\][^\u0007\u001B]{0,1000}(?:\u0007|\u001B\\))/g,I=/\u001B\[[\d;]*m[^\u001B]*(?:\u001B\[[\d;]*m|$)/g,g=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)[^\u001B]*\u001B\]8;;(?:\u0007|\u001B\\)/g,N=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,R=t(),L=/[-_./\s]+/g,T=/(\u001B\[[0-9;]*[a-z])/i,x=new RegExp("\\p{Script=Arabic}","u"),w=new RegExp("\\p{Script=Bengali}","u"),B=new RegExp("\\p{Script=Cyrillic}","u"),H=new RegExp("\\p{Script=Devanagari}","u"),G=new RegExp("\\p{Script=Ethiopic}","u"),O=new RegExp("\\p{Script=Greek}","u"),K=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),M=new RegExp("\\p{Script=Gujarati}","u"),C=new RegExp("\\p{Script=Gurmukhi}","u"),F=new RegExp("\\p{Script=Hangul}","u"),D=new RegExp("\\p{Script=Hebrew}","u"),l=new RegExp("\\p{Script=Hiragana}","u"),m=new RegExp("\\p{Script=Han}","u"),P=new RegExp("\\p{Script=Kannada}","u"),W=new RegExp("\\p{Script=Katakana}","u"),d=new RegExp("\\p{Script=Khmer}","u"),y=new RegExp("\\p{Script=Lao}","u"),U=new RegExp("\\p{Script=Latin}","u"),Y=new RegExp("\\p{Script=Malayalam}","u"),$=new RegExp("\\p{Script=Myanmar}","u"),h=new RegExp("\\p{Script=Oriya}","u"),k=new RegExp("\\p{Script=Sinhala}","u"),j=new RegExp("\\p{Script=Tamil}","u"),b=new RegExp("\\p{Script=Telugu}","u"),J=new RegExp("\\p{Script=Thai}","u"),V=new RegExp("\\p{Script=Tibetan}","u"),Z=/[\u02BB\u02BC\u0027]/u,f=s=>s.replace(R,"");export{M as A,C as B,P as C,j as D,b as E,Y as F,k as G,J as H,y as I,V as J,$ as K,G as L,d as M,h as N,p as O,c as P,a as Q,R,u as S,i as a,N as b,T as c,I as d,g as e,e as f,_ as g,o as h,r as i,A as j,S as k,B as l,U as m,O as n,K as o,Z as p,W as q,m as r,f as s,l as t,F as u,D as v,x as w,L as x,H as y,w as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function I(t){const n=t.match(/^[ \t]*(?=\S)/gm);if(!n)return t;let e=Number.POSITIVE_INFINITY;for(const r of n)e=Math.min(e,r.length);return e===0||e===Number.POSITIVE_INFINITY?t:t.replace(new RegExp(`^[ \\t]{${e}}`,"gm"),"")}function m(t){const n=t.replace(/^(?:[ \t]*\r?\n)+|(?:\r?\n[ \t]*)+$/g,"");return I(n)}export{m as dedent,I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isFullWidth as r,isWide as s,isAmbiguous as a,getCategory as u}from"./_isFullWidth-dWWDw5Is.js";function i(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function n(e){return i(e),u(e)}function p(e,{ambiguousAsWide:t=!1}={}){return i(e),r(e)||s(e)||t&&a(e)?2:1}export{r as _isFullWidth,s as _isWide,p as eastAsianWidth,n as eastAsianWidthType};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=(a,e)=>`${a}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`;export{r as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(t,e=1,o={}){const{indent:r=" ",includeEmptyLines:n=!1}=o;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return t;const p=n?/^/gm:/^(?!\s*$)/gm;return t.replace(p,r.repeat(e))}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as l}from"./constants-BGGeBKGT.js";const c=(i,r)=>{const{length:f}=i;if(f===0)return"";if(f===1)return i[0];const t=[];let e="",n="";for(let u=0;u<f;u++){const s=i[u];if(l.test(s)){e?(t.push(e+n+s),e="",n=""):(t.length>0&&t.push(r),e=s);continue}e?(n&&(n+=r),n+=s):(t.length>0&&t.push(r),t.push(s))}return t.join("")};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class s{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const c=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,c),c}has(e){return this.cache.has(e)}set(e,c){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const t=this.cache.keys().next().value;t!==void 0&&this.cache.delete(t)}this.cache.set(e,c)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}}export{s as
|
|
1
|
+
class s{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const c=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,c),c}has(e){return this.cache.has(e)}set(e,c){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const t=this.cache.keys().next().value;t!==void 0&&this.cache.delete(t)}this.cache.set(e,c)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}}export{s as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=/(?<![a-zß])SS(?![a-z])/g,n=a=>a.replaceAll(e,"ß");export{n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./indent-CY079Qyq.js";import i from"./dedent-CDXp3nZQ.js";function f(t,r=0,n={}){return e(i(t),r,n)}export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const r=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),t=e=>{if(typeof e!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof e}`);return e.replaceAll(r,"")};export{t as
|
|
1
|
+
const r=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),t=e=>{if(typeof e!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof e}`);return e.replaceAll(r,"")};export{t as s};
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
* @returns A tuple type of length L filled with type T
|
|
8
8
|
*/
|
|
9
9
|
type TupleOf<L extends number, T = unknown, Result extends any[] = []> = Result["length"] extends L ? Result : TupleOf<L, T, [...Result, T]>;
|
|
10
|
+
/**
|
|
11
|
+
* Repeat counts whose literal expansion stays within TypeScript's instantiation depth limit.
|
|
12
|
+
*/
|
|
13
|
+
type SafeRepeatCount = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45;
|
|
10
14
|
/**
|
|
11
15
|
* Internal type for implementing string slicing with both start and end indices.
|
|
12
16
|
* Handles edge cases and type safety for string literal types.
|
|
@@ -174,13 +178,14 @@ type PadStart<T extends string, Times extends number = 0, Pad extends string = "
|
|
|
174
178
|
/**
|
|
175
179
|
* Type-level implementation of string.repeat() functionality.
|
|
176
180
|
* Creates a new string type by repeating the input string a specified number of times.
|
|
181
|
+
* Counts above 45 fall back to `string` to avoid TypeScript's type-instantiation depth limit (TS2589).
|
|
177
182
|
* @template T - The string type to repeat
|
|
178
183
|
* @template Times - The number of times to repeat the string
|
|
179
184
|
* @returns A string type containing T repeated Times times
|
|
180
185
|
* @example
|
|
181
186
|
* type Repeated = Repeat<'abc', 2> // type Repeated = 'abcabc'
|
|
182
187
|
*/
|
|
183
|
-
type Repeat<T extends string, Times extends number = 0> = All<[IsStringLiteral<T>, IsNumberLiteral<Times>]> extends true ? Times extends 0 ? "" : Math.IsNegative<Times> extends false ? Join<TupleOf<Times, T>> : never : string;
|
|
188
|
+
type Repeat<T extends string, Times extends number = 0> = T extends T ? All<[IsStringLiteral<T>, IsNumberLiteral<Times>]> extends true ? Times extends 0 ? "" : Math.IsNegative<Times> extends false ? Times extends SafeRepeatCount ? Join<TupleOf<Times, T>> : string : never : string : never;
|
|
184
189
|
/**
|
|
185
190
|
* Type-level implementation of string.replaceAll() functionality.
|
|
186
191
|
* Replaces all occurrences of a substring with another string.
|
package/dist/replace-string.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OptionReplaceArray, e as IntervalArray } from "./packem_shared/types.d-
|
|
1
|
+
import { O as OptionReplaceArray, e as IntervalArray } from "./packem_shared/types.d-Bky9TnxG.js";
|
|
2
2
|
/**
|
|
3
3
|
* Performs multiple string or RegExp replacements using a refined pre-processing approach.
|
|
4
4
|
* @param source The string to search and replace in.
|
package/dist/replace-string.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const v=/\$([\d&$`'])/g,A=/\$(\d+|&|\$)/g,C=l=>{if(l.length===0)return[];const m=[];let f=[...l[0]];for(let c=1;c<l.length;c++){const h=l[c];h&&h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):(m.push(f),f=[...h])}return m.push(f),m},B=(l,m,f)=>{if(!l)return"";const c=[];let h=0;for(const n of m){const[e,r]=n;if(r!==void 0)try{if(e instanceof RegExp){const t=new RegExp(e.source,`${e.flags.replace("g","")}g`);let s;for(;(s=t.exec(l))!==null;){const i=s.index,d=s[0];d.length===0&&t.lastIndex===s.index&&(t.lastIndex+=1);const I=i+d.length-1,M=r.replaceAll(v,(R,o)=>{if(o==="&")return d;if(o==="$")return"$";if(o==="`")return l.slice(0,Math.max(0,i));if(o==="'")return l.slice(Math.max(0,i+d.length));const g=Number.parseInt(o,10);return s&&g>0&&g<s.length?s[g]??"":R});c.push({end:I,id:h++,original:d,replacement:M,start:i}),d.length===0&&t.lastIndex===i&&(t.lastIndex+=1)}}else if(typeof e=="string"&&e.length>0)for(let t=0;(t=l.indexOf(e,t))!==-1;t++){const s=t,i=e,d=s+i.length-1,I=Object.assign([i],{index:s,input:l}),M=r.replaceAll(A,(R,o)=>{if(o==="&")return i;if(o==="$")return"$";const g=Number.parseInt(o,10);return g>0&&g<I.length?I[g]??"":R});c.push({end:d,id:h++,original:i,replacement:M,start:s})}else continue}catch{continue}}c.sort((n,e)=>n.start!==e.start?n.start-e.start:e.end-n.end);const E=f.toSorted((n,e)=>n[0]-e[0]),$=C(E),a=l.split("").map((n,e)=>({appliedMatchId:void 0,char:n,index:e,insertBeforeReplacement:void 0,isIgnored:!1,isMatchStart:!1,matchReplacement:void 0}));for(const n of $){const e=n;for(let r=e[0];r<=e[1];r++)a[r]&&(a[r].isIgnored=!0)}let x="";for(const n of c){const e=n;if(e.original.length===0&&e.start>=0&&e.start<=a.length){const r=e.start;if(a[r]){const t=a[r];t.isIgnored||(t.insertBeforeReplacement=(t.insertBeforeReplacement??"")+e.replacement)}else r===a.length&&(x+=e.replacement)}}for(const n of c){const e=n;if(e.original.length===0)continue;let r=!0;for(let t=e.start;t<=e.end;t++)if(!a[t]||a[t].isIgnored||a[t].appliedMatchId!==void 0){r=!1;break}if(r&&e.start>=0&&e.start<a.length){for(let t=e.start;t<=e.end;t++)a[t]&&(a[t].appliedMatchId=e.id);a[e.start]&&(a[e.start].isMatchStart=!0,a[e.start].matchReplacement=e.replacement)}}let u="",p=0;for(;p<a.length;){const n=a[p];if(n.insertBeforeReplacement!==void 0&&(u+=n.insertBeforeReplacement),n.isMatchStart&&n.appliedMatchId!==void 0){u+=n.matchReplacement??"";let e=p;for(let r=p+1;r<a.length&&a[r]?.appliedMatchId===n.appliedMatchId;r++)e=r;p=e+1}else n.appliedMatchId===void 0&&(u+=n.char),p+=1}return x.length>0&&(u+=x),u};export{B as default};
|
package/dist/slice.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as
|
|
1
|
+
import{d as C,e as O,a as _}from"./packem_shared/constants-BGGeBKGT.js";import{getStringWidth as E}from"./get-string-width.js";import{s as R}from"./packem_shared/ansi-state-tracker-BFhXTS-5.js";import{L as F}from"./packem_shared/lru-cache-BD25OaEQ.js";const k=new F(100),N=new Intl.Segmenter("en",{granularity:"grapheme"}),P=/^[\u0000-\u007F]*$/,T=new Set(["0","22","23","24","27","28","29","39","49"]),M=new Set(["1","3","4","7","8","9"]),v=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),y=e=>R(e)==="foreground",W=e=>R(e)==="background",D=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],w=(e,l)=>{let c=-1;for(const u of l){const m=e.indexOf(u);m!==-1&&(c===-1||m<c)&&(c=m)}return c},$=(e,l)=>{if(!e.includes("\x1B"))return[{after:"",before:"",content:e,visibleLength:E(e,l.width)}];const c=`${JSON.stringify(l.width??void 0)}\0${e}`,u=k.get(c);if(u)return u;const m=[],S=[];let h=0,d;for(_.lastIndex=0;(d=_.exec(e))!==null;){const o=d[0];m.push(e.slice(h,d.index)),S.push(o),h=d.index+o.length}h<e.length&&m.push(e.slice(h));const f=[];for(const o of S){if(o==="\x1B[0m"||o==="\x1B]8;;\x07"){f.push(o);continue}if(o.startsWith("\x1B[")&&o.endsWith("m")){const x=o.slice(2,-1);if(T.has(x)){f.push(o);continue}}}const s=new Set,p=[];for(const[o,x]of m.entries()){if(o>0&&S[o-1]){const n=S[o-1];if(n==="\x1B[0m")s.clear();else if(n==="\x1B]8;;\x07"){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}}else if(n.startsWith("\x1B[")&&n.endsWith("m")){const i=n.slice(2,-1);if(i==="39"){for(const t of s)if(t.startsWith("\x1B[")&&t.endsWith("m")){const a=t.slice(2,-1);if(y(a)){s.delete(t);break}}}else if(i==="49"){for(const t of s)if(t.startsWith("\x1B[")&&t.endsWith("m")){const a=t.slice(2,-1);if(W(a)){s.delete(t);break}}}else if(v.has(i)){const t=v.get(i);for(const a of s)if(a===`\x1B[${t}m`){s.delete(a);break}}else{if(y(i)){for(const t of s)if(t.startsWith("\x1B[")&&t.endsWith("m")){const a=t.slice(2,-1);if(y(a)){s.delete(t);break}}}else if(W(i)){for(const t of s)if(t.startsWith("\x1B[")&&t.endsWith("m")){const a=t.slice(2,-1);if(W(a)){s.delete(t);break}}}else if(M.has(i)){const t=`\x1B[${i}m`;s.has(t)&&s.delete(t)}s.add(n)}}else if(n.startsWith("\x1B]8;;")&&!n.endsWith("\x1B]8;;\x07")){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}s.add(n)}}if(x==="")continue;let B="";if(s.size>0)if(f.includes("\x1B[0m"))B="\x1B[0m";else{const n=[];let i=!1;for(const r of s)if(r.startsWith("\x1B]8;;")&&!r.endsWith("\x1B]8;;\x07")){i=!0;break}i&&f.includes("\x1B]8;;\x07")&&n.push("\x1B]8;;\x07");let t=!1,a=!1;for(const r of s)if(r.startsWith("\x1B[")&&r.endsWith("m")){const g=r.slice(2,-1);y(g)?t=!0:W(g)&&(a=!0)}if(t&&a){const r=w(e,["\x1B[3","\x1B[9","\x1B[38;"]),g=w(e,["\x1B[4","\x1B[10","\x1B[48;"]);r>=0&&g>=0?r>g?n.push("\x1B[39m","\x1B[49m"):n.push("\x1B[49m","\x1B[39m"):n.push("\x1B[39m","\x1B[49m")}else t&&n.push("\x1B[39m"),a&&n.push("\x1B[49m");t&&a&&e.includes("\x1B[39m")&&e.includes("\x1B[49m")&&(e.indexOf("\x1B[39m")<e.indexOf("\x1B[49m")?(n.length-=2,n.push("\x1B[39m","\x1B[49m")):e.indexOf("\x1B[49m")<e.indexOf("\x1B[39m")&&(n.length-=2,n.push("\x1B[49m","\x1B[39m")));const L=D.filter(r=>s.has(r.open)).map(r=>({position:e.indexOf(r.open),style:r})).filter(r=>r.position>=0).toSorted((r,g)=>g.position-r.position);for(const r of L){const g=r;f.includes(g.style.close)&&n.push(g.style.close)}B=n.join("")}const b=[...s].join("");p.push({after:B,before:b,content:x,visibleLength:E(x,l.width)})}return k.set(c,p),p},A=(e,l,c,u)=>{const m=[...u.segmenter.segment(e)],S=[];let h=0,d=!1;for(const f of m){const s=E(f.segment,u.width),p=h,o=h+s;if(!d)if(p<l){h=o;continue}else d=!0;if(p>=c||o>c)break;S.push(f.segment),h=o}return S.join("")},H=(e,l=0,c=Number.MAX_SAFE_INTEGER,u={})=>{const m={segmenter:N,...u};if(l>=c||e==="")return"";const S=E(e,m.width);if(l===0&&c>=S)return e;if(l<0||c<0)throw new RangeError("Negative indices aren't supported");if(!e.includes("\x1B"))return P.test(e)?e.slice(l,c):A(e,l,c,m);if(C.lastIndex=0,O.lastIndex=0,!C.test(e)&&!O.test(e))return e;const h=$(e,m);if(h.length===0)return"";let d=0;const f=[];for(const[o,x]of h.entries()){const B=d,b=d+x.visibleLength;if(b>l&&B<c){const n=Math.max(0,l-B),i=Math.min(x.visibleLength,c-B);f.push({end:i,index:o,segment:x,start:n})}d=b}if(f.length===0)return"";const s=[],p=f[0].segment;s.push(p.before);for(let o=0;o<f.length;o++){const{end:x,segment:B,start:b}=f[o];if(b===0&&x===B.visibleLength?s.push(B.content):s.push(A(B.content,b,x,m)),o<f.length-1){const n=f[o+1].segment,i=B.after,t=n.before;i!==t&&(i||t)&&s.push(i,t)}}return s.push(f.at(-1).segment.after),s.join("")};export{H as slice};
|
package/dist/slugify.d.ts
CHANGED
package/dist/slugify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"./transliterate.js";import{escapeRegExp as
|
|
1
|
+
import c from"./transliterate.js";import{escapeRegExp as o}from"./utilities.js";const n={da:{Å:"AA",å:"aa",Æ:"AE",æ:"ae",Ø:"OE",ø:"oe"},de:{Ä:"AE",ä:"ae",Ö:"OE",ö:"oe",ß:"ss",Ü:"UE",ü:"ue"},nb:{Å:"AA",å:"aa",Æ:"AE",æ:"ae",Ø:"OE",ø:"oe"},sr:{Ć:"C",ć:"c",Č:"C",č:"c",Đ:"DJ",đ:"dj",Š:"S",š:"s",Ž:"Z",ž:"z"},tr:{Ç:"C",ç:"c",Ğ:"G",ğ:"g",I:"I",İ:"I",ı:"i",Ö:"O",ö:"o",Ş:"S",ş:"s",Ü:"U",ü:"u"},vi:{Đ:"D",đ:"d"}},p=a=>{const s=a.split("-")[0]?.toLowerCase()??"",e=n[s];return e?Object.entries(e):[]},i=(a,s)=>{const e=a?p(a):[],r=Array.isArray(s)?s:Object.entries(s??{});return[...e,...r]},u=(a,s,e)=>{const r=o(s).replaceAll(String.raw`\-`,"-"),t=new RegExp(`[^${r}]`,"g");return a.replaceAll(t,e)},w=(a,s)=>{const e={allowedChars:"a-zA-Z0-9-_.~",fixChineseSpacing:!0,ignore:[],lowercase:!0,replaceAfter:[],replaceBefore:[],separator:"-",transliterate:!0,trim:!1,unknown:"",uppercase:!1,...s};if(e.lowercase&&e.uppercase)throw new TypeError("slugify: The `lowercase` and `uppercase` options are mutually exclusive; enable at most one.");e.replaceBefore=i(e.locale??"",e.replaceBefore);let r=e.transliterate?c(a,e):a.normalize("NFC");e.lowercase?r=r.toLowerCase():e.uppercase&&(r=r.toUpperCase()),r=u(r,e.allowedChars,e.separator);const t=o(e.separator);if(t){const l=new RegExp(`${t}+`,"g");r=r.replace(l,e.separator)}return t?r.replaceAll(new RegExp(`^${t}+|${t}+$`,"g"),""):r};export{w as default};
|
package/dist/test/utils.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s as c}from"../packem_shared/strip-vt-control-characters-vMeu7uFw.js";import{getStringWidth as o}from"../get-string-width.js";const r=t=>{const e=c(t);return{ansi:t,json:JSON.stringify(t),lengthDifference:t.length-e.length,stripped:e,visible:t.replaceAll("\x1B",String.raw`\u001B`)}},l=(t,e)=>{const s=r(t),i=r(e);return{message:()=>{if(t===e)return"ANSI strings are identical";const n=s.stripped===i.stripped;return`ANSI string comparison failed:
|
|
2
2
|
|
|
3
3
|
Actual:
|
|
4
|
+
- Visible content: ${s.stripped}
|
|
5
|
+
- With escape codes: ${s.visible}
|
|
6
|
+
- JSON: ${s.json}
|
|
7
|
+
- Length: ${String(o(s.ansi))}
|
|
8
|
+
|
|
9
|
+
Expected:
|
|
4
10
|
- Visible content: ${i.stripped}
|
|
5
11
|
- With escape codes: ${i.visible}
|
|
6
12
|
- JSON: ${i.json}
|
|
7
|
-
- Length: ${String(
|
|
8
|
-
|
|
9
|
-
Expected:
|
|
10
|
-
- Visible content: ${n.stripped}
|
|
11
|
-
- With escape codes: ${n.visible}
|
|
12
|
-
- JSON: ${n.json}
|
|
13
|
-
- Length: ${String(a(n.ansi))}
|
|
13
|
+
- Length: ${String(o(i.ansi))}
|
|
14
14
|
|
|
15
|
-
${
|
|
16
|
-
`},pass:e
|
|
15
|
+
${n?"✓ Visible content is identical, but escape codes differ":"✗ Visible content differs"}
|
|
16
|
+
`},pass:t===e}},g=(t,e)=>{const s=r(t),i=r(e),n=s.stripped===i.stripped,p=t===e;return{actual:s,ansiEqual:p,expected:i,strippedEqual:n,summary:{actualLength:t.length,actualStrippedLength:s.stripped.length,ansiEqual:p,expectedLength:e.length,expectedStrippedLength:i.stripped.length,strippedEqual:n}}};export{g as compareAnsiStrings,l as expectAnsiStrings,r as formatAnsiString};
|
package/dist/transliterate.d.ts
CHANGED