chore(runfiles): accept rules_js env as well
diff --git a/internal/runfiles/index.cjs b/internal/runfiles/index.cjs index ee37219..e46f207 100644 --- a/internal/runfiles/index.cjs +++ b/internal/runfiles/index.cjs
@@ -65,11 +65,11 @@ --spawn_strategy=standalone to the command line.`); } // Bazel starts actions with pwd=execroot/my_wksp or pwd=runfiles/my_wksp - this.workspace = _env['BAZEL_WORKSPACE'] || undefined; + this.workspace = _env['BAZEL_WORKSPACE'] || _env['JS_BINARY__WORKSPACE'] || undefined; // If target is from an external workspace such as @npm//rollup/bin:rollup // resolvePackageRelative is not supported since package is in an external // workspace. - const target = _env['BAZEL_TARGET']; + let target = _env['BAZEL_TARGET'] || _env['JS_BINARY__TARGET']; if (!!target && !target.startsWith('@')) { // //path/to:target -> path/to this.package = target.split(':')[0].replace(/^\/\//, '');
diff --git a/packages/runfiles/runfiles.ts b/packages/runfiles/runfiles.ts index 37528d8..d4e820a 100755 --- a/packages/runfiles/runfiles.ts +++ b/packages/runfiles/runfiles.ts
@@ -44,11 +44,11 @@ --spawn_strategy=standalone to the command line.`); } // Bazel starts actions with pwd=execroot/my_wksp or pwd=runfiles/my_wksp - this.workspace = _env['BAZEL_WORKSPACE'] || undefined; + this.workspace = _env['BAZEL_WORKSPACE'] || _env['JS_BINARY__WORKSPACE'] || undefined; // If target is from an external workspace such as @npm//rollup/bin:rollup // resolvePackageRelative is not supported since package is in an external // workspace. - const target = _env['BAZEL_TARGET']; + let target = _env['BAZEL_TARGET'] || _env['JS_BINARY__TARGET']; if (!!target && !target.startsWith('@')) { // //path/to:target -> path/to this.package = target.split(':')[0].replace(/^\/\//, '');