guybedford / chomp

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

Add ability to specify ignore paths in the deps array #125

Closed zachsa closed 2 years ago

zachsa commented 2 years ago

Something like

deps = [
  'server/**/*.js',
  '!server/ssr/*.js',
  'node.importmap'
]

That would ignore all js files in server/ssr, but include all js files in server/ssr/src

guybedford commented 2 years ago

We use https://docs.rs/glob/0.3.0/glob/struct.Pattern.html which has the rules in that documentation page.

Specifically, there is some negation syntax:

[...] matches any character inside the brackets. Character sequences can also specify ranges of characters, as ordered by Unicode, so e.g. [0-9] specifies any character between 0 and 9 inclusive. An unclosed bracket is invalid.

[!...] is the negation of [...], i.e. it matches any characters not in the brackets.

The metacharacters ?, *, [, ] can be matched by using brackets (e.g. [?]). When a ] occurs immediately following [ or [! then it is interpreted as being part of, rather then ending, the character set, so ] and NOT ] can be matched by []] and [!]] respectively. The - character can be specified inside a character sequence pattern by placing it at the start or the end, e.g. [abc-].

Some combination of the above may be able to achieve your use case.

zachsa commented 2 years ago

Ah, thank you.

Can that be used for hash-style deps = dep = 'src/##.ts'?

I can't easily see how I would structure a dep with an ignore. If you know this offhand, could be helpful in the docs. Because I didn't know how to do this I've restructured my files so that I don't have to ignore anything. But could be useful in the future.

guybedford commented 2 years ago

No, interpolations do not permit additional glob filter rules due to the 1-1 requirement.