feat(config): support globs in links#34849
Conversation
Co-Authored-By: Divy Srivastava <[email protected]>
110c0df to
5013e0d
Compare
bartlomieju
left a comment
There was a problem hiding this comment.
Nice — glob expansion, file:// globs, and negation all look correct, validation isn't bypassed (glob results flow through the same WorkspaceMemberNotAllowed/root-self-link checks), and the tests cover the happy paths. One change I'd like before merge:
Replace the "<glob>" placeholder with the actual glob string in errors. Glob-expanded entries currently carry a placeholder as raw_member:
link_dir_urls.extend(
pattern_link_dir_urls.into_iter().map(|u| ("<glob>".to_string(), u)),
);That raw_member is what ends up in both the ResolveLink error and the WorkspaceMemberNotAllowed error. So if a glob sweeps in a workspace member or the root (e.g. links: ["../*"]), or a match fails to resolve, the user gets:
... link '<glob>' ...
which is unactionable — it doesn't say which links entry caused it. Could you thread the originating pattern through collect_link_config_folders (return (raw_link, Url) pairs, or a map from result URL back to its source pattern) so the error names the verbatim glob, e.g. link '../*'? Even just the matched directory URL would be a big improvement, but the source pattern is what the user actually wrote, so that's ideal.
And please add a regression test that hits this error path so the message is exercised and locked in — e.g. a glob that expands to include the root config folder (or a workspace member), asserting the resulting diagnostic/error contains the originating pattern string rather than <glob>. Right now all three tests are on the success path, so the error label has no coverage.
Everything else LGTM.
Adds glob expansion for deno.json links entries so local JSR/npm package folders can be linked with patterns, including file:// glob URLs.
Updates the config schema description and covers relative globs, file URL globs, and negated link patterns in workspace discovery tests.
Closes #31708
Closes denoland/divybot#456