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{
22 "name" : " deepcrawl" ,
3- "version" : " 0.1.17 " ,
3+ "version" : " 0.1.18 " ,
44 "description" : " JavaScript/TypeScript SDK for DeepCrawl API - A powerful web scraping and crawling service" ,
55 "main" : " ./dist/index.js" ,
66 "module" : " ./dist/index.mjs" ,
Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ export class DeepcrawlApp {
187187 >
188188 > ;
189189 private config : DeepcrawlConfig ;
190- private nodeEnv : 'nodeJs' | 'cf-worker' = 'nodeJs' ;
190+ private nodeEnv : 'nodeJs' | 'cf-worker' | 'browser' = 'nodeJs' ;
191191 private httpsAgent ?: Agent ; // Node.js https.Agent
192192
193193 /**
@@ -223,15 +223,17 @@ export class DeepcrawlApp {
223223 ...config ,
224224 } ;
225225
226- // Detect runtime environment in a concise, declarative way
226+ // Detect runtime environment with better browser detection
227227 this . nodeEnv =
228228 typeof process !== 'undefined' && ! ! process . versions ?. node
229229 ? 'nodeJs'
230230 : typeof globalThis . caches !== 'undefined' &&
231231 typeof ( globalThis as { EdgeRuntime ?: unknown } ) . EdgeRuntime ===
232232 'undefined'
233233 ? 'cf-worker'
234- : 'nodeJs' ;
234+ : typeof window !== 'undefined' || typeof navigator !== 'undefined'
235+ ? 'browser'
236+ : 'nodeJs' ;
235237
236238 if ( ! this . config . apiKey ) {
237239 throw new DeepcrawlAuthError ( 'API key is required' ) ;
You can’t perform that action at this time.
0 commit comments