Skip to content

Commit 59a11ec

Browse files
committed
Implement a mock Netlify global based upon the published NetlifyGlobal interface
We no longer publish the actual implementation of our Netlify global for edge functions, we only publish the types This file is used for parsing the 'in-source configuration' - which is why using a simple implementation for the Netlify global such as the one provided should be good enough Her eis the previous PR which added the Netlify global into this file for context -- netlify/edge-bundler#427
1 parent 9b716c0 commit 59a11ec

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/edge-bundler/deno/config.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
// this needs to be updated whenever there's a change to globalThis.Netlify in bootstrap
2-
import { Netlify } from "https://64e8753eae24930008fac6d9--edge.netlify.app/bootstrap/index-combined.ts"
1+
import { type NetlifyGlobal } from 'https://edge.netlify.com/bootstrap/globals/types.ts'
32

43
const [functionURL, collectorURL, rawExitCodes] = Deno.args
54
const exitCodes = JSON.parse(rawExitCodes)
65

6+
const env = {
7+
delete: Deno.env.delete,
8+
get: Deno.env.get,
9+
has: Deno.env.has,
10+
set: Deno.env.set,
11+
toObject: Deno.env.toObject,
12+
};
13+
14+
const Netlify: NetlifyGlobal = {
15+
get context() {
16+
return null;
17+
},
18+
env,
19+
};
20+
721
globalThis.Netlify = Netlify
822

923
let func

0 commit comments

Comments
 (0)