Skip to content
Myr

fix(context): check cloudflare before checking node in `c.runtime` (#651)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* fix(context): check cloudflare before checking node in `c.runtime` * denoify

authored by Yusuke Wada · committed by GitHub · parent 4a9cd27 · Browse files · 3 files+10 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−10 removed

  • tests:+2 added−2 removed
  • other:+8 added−8 removed

3 files+10 added−10 removed

modified:deno_dist/context.ts+4 added-4 removed
196 unmodified lines
197 get runtime(): Runtime {198 // eslint-disable-next-line @typescript-eslint/no-explicit-any199 const global = globalThis as any200201 if (global?.process?.title === 'node') {202 return 'node'203 }204201 if (global?.Deno !== undefined) {202 return 'deno'203 }204
12 unmodified lines
217 if (typeof global?.EdgeRuntime !== 'string') {218 return 'vercel'219 }220221 if (global?.process?.title === 'node') {222 return 'node'223 }224225 return 'other'226 }227}
modified:src/context.test.ts+2 added-2 removed
modified:src/context.ts+4 added-4 removed
196 unmodified lines
197 get runtime(): Runtime {198 // eslint-disable-next-line @typescript-eslint/no-explicit-any199 const global = globalThis as any200201 if (global?.process?.title === 'node') {202 return 'node'203 }204201 if (global?.Deno !== undefined) {202 return 'deno'203 }204
12 unmodified lines
217 if (typeof global?.EdgeRuntime !== 'string') {218 return 'vercel'219 }220221 if (global?.process?.title === 'node') {222 return 'node'223 }224225 return 'other'226 }227}