File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3+ import { spawnSync } from 'node:child_process'
4+ import { fileURLToPath } from 'node:url'
5+
36// import cluster from 'cluster'
47import { Healthcheck } from './healthcheck.js'
58import { processOptions , cli } from './cli.js'
69import logger from './logger.js'
710
11+ // Re-exec under --conditions=development if not already set.
12+ // Without this, bin.js loads hooks via src/ while the user jobfile loads them via dist/index.mjs
13+ // (per package.json `exports.import`), giving two distinct hooks registries and breaking
14+ // custom hook registration. The development condition unifies both resolutions on src/.
15+ const hasDevCondition = process . execArgv . some ( arg =>
16+ arg === '--conditions=development' ||
17+ ( arg . startsWith ( '--conditions=' ) && arg . slice ( '--conditions=' . length ) . split ( ',' ) . includes ( 'development' ) )
18+ )
19+ if ( ! hasDevCondition ) {
20+ const child = spawnSync (
21+ process . execPath ,
22+ [ '--conditions=development' , fileURLToPath ( import . meta. url ) , ...process . argv . slice ( 2 ) ] ,
23+ { stdio : 'inherit' }
24+ )
25+ process . exit ( child . status ?? 1 )
26+ }
27+
828/* WIP: cluster mode, the main issue is that stores are created by a job before hook
929 thus are not availalbe on workers not running the job but running only tasks
1030if (cluster.isMaster) {
Original file line number Diff line number Diff line change @@ -27,11 +27,15 @@ export function getRequestParameters (options) {
2727 method : options . method || 'GET' ,
2828 headers : options . headers ,
2929 body : options . body ,
30- searchParams : buildSearchParams ( queryParameters ) ,
3130 cookieJar : options . jar ,
3231 // Do not throw on non-2xx so the downstream consumer can read statusCode from the 'response' event
3332 throwHttpErrors : false
3433 }
34+ // Only set searchParams when we actually have params; otherwise got would override
35+ // any pre-existing query string already embedded in options.url.
36+ if ( Object . keys ( queryParameters ) . length > 0 ) {
37+ requestParameters . searchParams = buildSearchParams ( queryParameters )
38+ }
3539 if ( options . timeout ) {
3640 requestParameters . timeout = { request : options . timeout }
3741 }
You can’t perform that action at this time.
0 commit comments