@@ -83,6 +83,16 @@ clear_non_sh_env() {
8383 fi
8484}
8585
86+ append_node_dependency_path () {
87+ export PREV_NODE_PATH=" ${NODE_PATH:= } "
88+
89+ local pnpm_global_path=$( pnpm root -g 2> /dev/null)
90+ if [[ -n " $pnpm_global_path " ]]; then
91+ export QL_NODE_GLOBAL_PATH=" $pnpm_global_path "
92+ export NODE_PATH=" ${NODE_PATH: +${NODE_PATH} : }${pnpm_global_path} "
93+ fi
94+ }
95+
8696enter_script_workdir () {
8797 local use_dot_prefix=" $1 "
8898
@@ -241,7 +251,7 @@ check_nounset() {
241251}
242252
243253main () {
244- if [[ $1 == * .js ]] || [[ $1 == * .py ]] || [[ $1 == * .pyc ]] || [[ $1 == * .sh ]] || [[ $1 == * .ts ]]; then
254+ if [[ $1 == * .js ]] || [[ $1 == * .mjs ]] || [[ $1 == * . py ]] || [[ $1 == * .pyc ]] || [[ $1 == * .sh ]] || [[ $1 == * .ts ]]; then
245255 if [[ $1 == * .sh ]]; then
246256 timeoutCmd=" "
247257 fi
@@ -277,6 +287,7 @@ main() {
277287
278288handle_task_start " ${task_shell_params[@]} "
279289check_file " ${task_shell_params[@]} "
290+ append_node_dependency_path
280291if [[ $isJsOrPythonFile == ' false' ]]; then
281292 run_task_before " ${task_shell_params[@]} "
282293fi
@@ -286,6 +297,8 @@ main "${task_shell_params[@]}"
286297if [[ " $set_u_on " == ' true' ]]; then
287298 set -u
288299fi
300+ export NODE_PATH=" ${PREV_NODE_PATH} "
301+ unset QL_NODE_GLOBAL_PATH
289302if [[ $isJsOrPythonFile == ' true' ]]; then
290303 export NODE_OPTIONS=" ${PREV_NODE_OPTIONS} "
291304 export PYTHONPATH=" ${PREV_PYTHONPATH} "
0 commit comments