Skip to content

Commit ba29db0

Browse files
committed
chore: needs to be js
1 parent 2acfae1 commit ba29db0

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

packages/runtime/src/helpers/edge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const getMiddlewareBundle = async ({
105105
}): Promise<string> => {
106106
const { publish } = netlifyConfig.build
107107

108-
const shims = await fs.readFile(getEdgeTemplatePath('shims.ts'), 'utf8')
108+
const shims = await fs.readFile(getEdgeTemplatePath('shims.js'), 'utf8')
109109

110110
const chunks: Array<string> = [shims]
111111

packages/runtime/src/templates/edge/shims.ts renamed to packages/runtime/src/templates/edge/shims.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-check
12
// deno-lint-ignore-file no-var prefer-const no-unused-vars no-explicit-any
23
import { decode as _base64Decode } from 'https://deno.land/std@0.175.0/encoding/base64.ts'
34
import { AsyncLocalStorage as ALSCompat } from 'https://deno.land/std@0.175.0/node/async_hooks.ts'
@@ -7,17 +8,9 @@ import { AsyncLocalStorage as ALSCompat } from 'https://deno.land/std@0.175.0/no
78
* This file isn't imported, but is instead inlined along with other chunks into the edge bundle.
89
*/
910

10-
declare global {
11-
var process: {
12-
env: Record<string, string>
13-
}
14-
var EdgeRuntime: string
15-
var AsyncLocalStorage: typeof ALSCompat
16-
var _ASSETS: Record<string, string>
17-
}
18-
1911
// Deno defines "window", but naughty libraries think this means it's a browser
20-
delete (globalThis as Omit<typeof globalThis, 'window'> & Pick<Partial<typeof globalThis>, 'window'>).window
12+
// @ts-ignore
13+
delete globalThis.window
2114
globalThis.process = {
2215
env: { ...Deno.env.toObject(), NEXT_RUNTIME: 'edge', NEXT_PRIVATE_MINIMAL_MODE: '1' },
2316
}
@@ -29,7 +22,8 @@ globalThis.AsyncLocalStorage = ALSCompat
2922

3023
// Next.js uses this extension to the Headers API implemented by Cloudflare workerd
3124
if (!('getAll' in Headers.prototype)) {
32-
;(Headers as any).prototype.getAll = function getAll(name: string) {
25+
// @ts-ignore
26+
Headers.prototype.getAll = function getAll(name) {
3327
name = name.toLowerCase()
3428
if (name !== 'set-cookie') {
3529
throw new Error('Headers.getAll is only supported for Set-Cookie')
@@ -39,7 +33,7 @@ if (!('getAll' in Headers.prototype)) {
3933
}
4034
// Next uses blob: urls to refer to local assets, so we need to intercept these
4135
const _fetch = globalThis.fetch
42-
const fetch: typeof globalThis.fetch = async (url, init) => {
36+
const fetch /* type {typeof globalThis.fetch} */ = async (url, init) => {
4337
try {
4438
if (url instanceof URL && url.href?.startsWith('blob:')) {
4539
const key = url.href.slice(5)

0 commit comments

Comments
 (0)