rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

[FR]: @bazel/runfiles needs to handle repo mapping

Open jfirebaugh opened this issue 1 year ago • 8 comments

What is the current behavior?

The @bazel/runfiles library fails to find runfiles specified with apparent repository names when Bzlmod is enabled.

Describe the feature

Equivalent to https://github.com/bazelbuild/rules_go/pull/3347 / https://github.com/bazelbuild/rules_python/pull/998.

jfirebaugh avatar Feb 02 '24 20:02 jfirebaugh

@fmeum I know you visited a lot of languages in the ecosystem for the other runfiles fixes. I don't recall, did you have a look here as well?

alexeagle avatar Feb 02 '24 20:02 alexeagle

The lookup procedure itself looks sound. It's really just the repo mapping logic that is missing.

My JS is pretty rusty, so I would prefer someone else to implement this, but I can review the PR. The Python library can serve as a reference here.

The challenging part would be determining the current repo. I don't know how one would get the path of the current source file in JS. Minification and bundling could be problematic in this context. Can source maps be consumed at runtime?

fmeum avatar Feb 04 '24 14:02 fmeum

@ewhauser is this something you're interested in pairing with Fabian on?

alexeagle avatar Feb 05 '24 16:02 alexeagle

This issue has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs in 30 days. Note as of rules_nodejs v6 the rules_nodejs repository contains only the core nodejs toolchain and @bazel/runfiles package. All rulesets are removed and unmaintained. For alternate rulesets suggestions include https://github.com/aspect-build/rules_js, https://github.com/aspect-build/rules_ts Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

github-actions[bot] avatar Apr 06 '24 01:04 github-actions[bot]

Can someone please add a label to turn off the stale bot for this issue? This blocks use of bzlmod for anyone using @bazel/runfiles so it's not going to go stale.

jfirebaugh avatar Apr 06 '24 02:04 jfirebaugh

This issue has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs in 30 days. Note as of rules_nodejs v6 the rules_nodejs repository contains only the core nodejs toolchain and @bazel/runfiles package. All rulesets are removed and unmaintained. For alternate rulesets suggestions include https://github.com/aspect-build/rules_js, https://github.com/aspect-build/rules_ts Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

github-actions[bot] avatar Jun 06 '24 02:06 github-actions[bot]

sigh Not stale.

jfirebaugh avatar Jun 06 '24 02:06 jfirebaugh

I'm tempted to move the implementation of the runfiles library to rules_js at this point in the process of fixing it for bzlmod. rules_nodejs now only supplies the Node.js toolchain and no longer deals with the runtime js_binary / js_test implementation. I'm not sure we even have the right permissions to publish to the @bazel/runfiles npm package anymore.

gregmagolan avatar Jun 08 '24 21:06 gregmagolan