Skip to content

Commit db4f02d

Browse files
committed
refactor: adjust node middleware handling to share common handling with edge middleware
1 parent 8669b58 commit db4f02d

File tree

3 files changed

+169
-202
lines changed

3 files changed

+169
-202
lines changed
File renamed without changes.

edge-runtime/shim/node.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// NOTE: This is a fragment of a JavaScript program that will be inlined with
2+
// a Webpack bundle. You should not import this file from anywhere in the
3+
// application.
4+
import { AsyncLocalStorage } from 'node:async_hooks'
5+
6+
import { createRequire } from 'node:module' // used in dynamically generated part
7+
import process from 'node:process'
8+
9+
import { registerCJSModules } from '../edge-runtime/lib/cjs.ts' // used in dynamically generated part
10+
11+
globalThis.process = process
12+
13+
globalThis.AsyncLocalStorage = AsyncLocalStorage
14+
15+
// needed for path.relative and path.resolve to work
16+
Deno.cwd = () => ''

0 commit comments

Comments
 (0)