Skip to content

GlobLimits

GlobLimits = object

Defined in: packages/format-glob/src/limits.ts:17

Bounds on what a pattern may cost to parse, to compile and to run.

A glob arrives from a configuration file, a command line or a remote document, so its size is the caller’s problem and not the author’s. Every bound here guards a different multiplier: the source text, the combinatorial expansion braces perform on it, the nesting an extglob adds, and the state count complementing !(…) reaches. The RegexLimits passed through to @ac-kit/format-regex then bound the compiled program and the run.

readonly optional maxBraceDepth?: number

Defined in: packages/format-glob/src/limits.ts:27

Deepest brace nesting accepted. Real patterns nest one or two deep.


readonly optional maxBraceProduct?: number

Defined in: packages/format-glob/src/limits.ts:36

Most alternatives brace expansion may produce.

The combinatorial size, not the nesting: {a,b}{a,b}{a,b} is three levels of one branch each and eight alternatives, so depth alone does not bound it. Computed over the parsed tree in O(nodes).


readonly optional maxComplementStates?: number

Defined in: packages/format-glob/src/limits.ts:58

Most states the determinised automaton behind one !(…) may hold.

Complementing a regular language means determinising it first, and subset construction is exponential in the worst case — !(*a*b*c*…) is that case. This is the bound that makes !(…) safe to compile at all.


readonly optional maxExtglobDepth?: number

Defined in: packages/format-glob/src/limits.ts:39

Deepest extglob nesting accepted — !(a|@(b|c)) is two.


readonly optional maxPatternLength?: number

Defined in: packages/format-glob/src/limits.ts:24

Longest pattern accepted, in characters.

Checked before anything is parsed, so every other bound applies to an already-bounded input.


readonly optional maxRangeExpansion?: number

Defined in: packages/format-glob/src/limits.ts:49

Most values a numeric range inside an extglob body may expand to.

Only reached there: outside an extglob a range is matched by capturing the digits and checking the bound afterwards, which costs the same whatever the bound is. Inside one it has to become real alternatives, because a complement is taken over a language rather than over a capture.


readonly optional regex?: RegexLimits

Defined in: packages/format-glob/src/limits.ts:61

Passed to @ac-kit/format-regex on the Pike-VM backend.