feat: add parse_task_dependency for deno task dependency args#183
Closed
bartlomieju wants to merge 1 commit into
Closed
feat: add parse_task_dependency for deno task dependency args#183bartlomieju wants to merge 1 commit into
parse_task_dependency for deno task dependency args#183bartlomieju wants to merge 1 commit into
Conversation
Add a `parse_task_dependency` helper (and `TaskDependency` type) that splits a dependency entry such as `test --coverage='.coverage/' --clean` into a task name and the literal arguments to forward to it, honoring and removing quotes. It reuses the existing shell parser and rejects anything that would require a runtime environment or alter control flow (pipelines, boolean and sequential operators, background `&`, redirects, subshells, `!` negation, env assignments, and args containing variable/command/tilde/ brace expansions), so a dependency string resolves unambiguously at configuration-load time. Groundwork for denoland/deno#27870.
dsherret
reviewed
Jun 4, 2026
Contributor
There was a problem hiding this comment.
I feel like this should live in deno instead? It doesn't really have to do with shell parsing or execution.
Member
Author
|
Agreed with @dsherret — this is consumer-side policy over the already-public parser AST (deno-specific |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
parse_task_dependencyhelper (and aTaskDependencytype) thatsplits a
deno taskdependency entry into a task name and the literalarguments to forward to that task. This is the
deno_task_shellpiece ofdenoland/deno#27870, which asks for dependencies like
"test --coverage='.coverage/' --clean"so a task can run a dependencywith extra flags without defining a duplicate task.
Today dependencies are treated as bare task names, so the argument
splitting has to live somewhere. Doing it here lets the deno CLI reuse
the existing shell parser instead of hand-rolling quote handling: the
helper parses the entry, requires it to be a single plain command, and
returns the first word as the name and the remaining words as args, with
quotes honored and removed (so
--flag='a b'becomes the single argument--flag=a b).To keep a dependency string unambiguous at configuration-load time,
anything that would need a runtime environment or change control flow is
rejected with a descriptive error: pipelines, boolean and sequential
operators (
&&,||,;), background&, redirects, subshells,!negation, environment variable assignments, and any argument containing
variable substitution, command substitution, tilde expansion, or brace
expansion. Bare names like
"test"keep working unchanged.This only adds the parsing helper; wiring it into the task graph
(notably keying the dependency graph on name plus args so the same task
can run with different arguments) is a follow-up in the deno repo.
Unit tests cover the accepted forms, quote handling, and each rejected
case.