Releases: the-cookbook/pathkit
v1.0.1
@cookbook/pathkit
1.0.1
Patch Changes
-
a6ff9d3: Fix
matchstrict mode so routes with constrained parameters throw validation errors instead of returning a failed match.On the previous released
v2.0.0, constraint regexes could prevent a route from matching before strict constraint validation ran. Strict mode now allows structurally matching constrained parameters first, then validates the captured values and throws when a constraint fails.
v1.0.0
@cookbook/pathkit
1.0.0
Major Changes
-
f35b7e8: Add new route matching options for router-style integrations.
New match options:
end: controls whether a route must match the full path or can match a path prefix.sensitive: controls case-sensitive matching.wildcardFormat: controls whether wildcard params are returned as astringorstring[].decode: controls whether matched params are returned raw, decoded withdecodeURIComponent, or decoded with a custom function.
Successful match results now include the consumed
path, which is required for prefix-based middleware mounting.Wildcard parameters can now be returned as arrays by passing
wildcardFormat: 'array'.Params are still returned raw by default. Pass
decode: trueto decode params withdecodeURIComponent, or pass a custom decoder function withdecode: (value) => value.This is marked as a major change because successful match results have an expanded return shape and wildcard params can now be typed as
string[]whenwildcardFormat: 'array'is used.
v0.4.1
@cookbook/pathkit
0.4.1
Patch Changes
-
db577c1: Improve
regexconstraint normalization when generating route match patterns.The
regexconstraint now removes wrapping^and unescaped trailing$anchors from the provided regex source before composing the final route matcher.Examples:
/posts/{slug:regex(^[a-z0-9-]+$)} /posts/{slug:regex([a-z0-9-]+)}
v0.4.0
@cookbook/pathkit
0.4.0
Minor Changes
-
dcc0878: Add support for numeric value constraints with the new
minandmaxconstraints.Examples:
{ pattern: '/products/{value:decimal:max(10)}', path: '/products/9.99', matches: { match: true, params: { value: '9.99' }, }, } { pattern: '/products/{value:decimal:min(1)}', path: '/products/9.99', matches: { match: true, params: { value: '9.99' }, }, } { pattern: '/products/{value:decimal:min(1):max(10)}', path: '/products/9.99', matches: { match: true, params: { value: '9.99' }, }, }
Both constraints expect a numeric argument and validate the route parameter value itself.
minvalidates that the parameter value is greater than or equal to the specified number, whilemaxvalidates that it is less than or equal to the specified number.These constraints are different from
minlengthandmaxlength, which validate the length of the parameter value instead. -
21e7658: Add support for minimum- and maximum-length route parameters through the new
minlengthandmaxlengthconstraints.Usage:
/product/{slug:minlength(3)} /product/{slug:maxlength(50)} /product/{slug:minlength(3):maxlength(50)}Both constraints expect a positive integer argument.
minlengthvalidates that the route parameter value has at least the specified number of characters, whilemaxlengthvalidates that it has no more than the specified number of characters. -
64d4844: Add support for UUID route parameters with the new
uuidconstraint.Examples:
{ pattern: '/users/{id:uuid}', path: '/users/7d444840-9dc0-11d1-b245-5ffdce74fad2', matches: { match: true, params: { id: '7d444840-9dc0-11d1-b245-5ffdce74fad2' }, }, }
The
uuidconstraint validates that the route parameter value matches the canonical UUID format:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
This constraint accepts UUID-like values such as UUID v1, v3, v4, and v5, as long as they use the standard hyphenated UUID format.
Patch Changes
v0.3.1
@cookbook/pathkit
0.3.1
Patch Changes
-
bc195cf: Fix
regexpath constraint validation to require full segment matches.Previously, the
regexconstraint validator used the provided expression directly withRegExp.test(...), which allowed partial substring matches. For example,[a-z0-9-]+incorrectly acceptedPostbecause the substringostmatched.The validator now uses the constraint's sanitized
toRegExp(...)source and anchors it as a full-segment match with^(?:...)$. This aligns runtime constraint validation with path matching behavior and prevents invalid path params from passing validation.
v0.3.0
v0.2.1
Patch release
This release improves strict route matching validation and expands test coverage across core utilities.
Fixed
- Added strict-mode validation for unknown route constraints.
match()now throws when an unregistered constraint is used withstrict: true.- Preserved non-strict behavior for unknown constraints.
Tests
- Added coverage for strict unknown constraint validation.
- Improved coverage for route matching helpers.
- Added utility coverage for:
happentypeOftokensegment-filterescapeRegexis
Notes
This is a patch release because the change fixes strict-mode validation behavior without introducing a new public API.