guybedford / chomp

'JS Make' - parallel task runner for the frontend ecosystem with a JS extension system.
https://chompbuild.com
Apache License 2.0
143 stars 7 forks source link

Interpolation pattern modifiers #166

Open guybedford opened 1 year ago

guybedford commented 1 year ago

In interpolation patterns, it could be useful to support a new modifier syntax for eg handling excludes in the target space:

dep = "./src/##.ts"
targets = "lib/##[~(index|module)].js"

where if a dependency resulted in the invalid target, it would be automatically ignored, and conversely if building a target in the exclude space, it wouldn't match the interpolation.

Ideally we should use some sensible existing pattern system.

#[name] has been talked about for named parameters in some interpolation use cases, perhaps we just disambiguate via syntax eg via #{name} for that instead.

Effectively this syntax just allows providing a custom pattern instead of the default of **/* to match. The hard part as always with interpolation is handling bi-directional mapping support.