Skip to content
Myr

fix: check `global.fastly` instead of `require('fastly:env')` (#1057)

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

* fix: use `global.fastly` instead of `require('fastly:env')` * denoify

authored by Yusuke Wada · committed by GitHub · parent 7c6ebe8 · Browse files · 5 files+14 added−37 removed
This commit

State

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

Diff stats

5 files+14 added−37 removed

  • tests:+4 added−1 removed
  • other:+10 added−36 removed

5 files+14 added−37 removed

modified:deno_dist/adapter.ts+4 added-10 removed
modified:deno_dist/context.ts+1 added-8 removed
358 unmodified lines
359 if (typeof global?.EdgeRuntime === 'string') {360 return 'edge-light'361 }362363 let onFastly = false364 try {365 // eslint-disable-next-line @typescript-eslint/ban-ts-comment366 // @ts-ignore367 const { env } = require('fastly:env')368 if (env instanceof Function) onFastly = true369 } catch {}370 if (onFastly) {363 if (global?.fastly !== undefined) {364 return 'fastly'365 }366367 if (global?.__lagon__ !== undefined) {
10 unmodified lines
modified:src/adapter.ts+4 added-10 removed
modified:src/context.ts+1 added-8 removed
358 unmodified lines
359 if (typeof global?.EdgeRuntime === 'string') {360 return 'edge-light'361 }362363 let onFastly = false364 try {365 // eslint-disable-next-line @typescript-eslint/ban-ts-comment366 // @ts-ignore367 const { env } = require('fastly:env')368 if (env instanceof Function) onFastly = true369 } catch {}370 if (onFastly) {363 if (global?.fastly !== undefined) {364 return 'fastly'365 }366367 if (global?.__lagon__ !== undefined) {
10 unmodified lines
modified:test_fastly/index.test.ts+4 added-1 removed