File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,14 @@ import { version } from "../package.json";
22import type { Preset } from "unenv" ;
33
44// Built-in APIs provided by workerd.
5+ //
56// https://developers.cloudflare.com/workers/runtime-apis/nodejs/
67// https://github.com/cloudflare/workerd/tree/main/src/node
8+ //
79// Last checked: 2025-01-24
8- const cloudflareNodeCompatModules = [
10+ //
11+ // NOTE: Please sync any changes to `testNodeCompatModules`.
12+ const nodeCompatModules = [
913 "_stream_duplex" ,
1014 "_stream_passthrough" ,
1115 "_stream_readable" ,
@@ -53,7 +57,7 @@ export const cloudflare: Preset = {
5357 } ,
5458 alias : {
5559 ...Object . fromEntries (
56- cloudflareNodeCompatModules . flatMap ( ( p ) => [
60+ nodeCompatModules . flatMap ( ( p ) => [
5761 [ p , p ] ,
5862 [ `node:${ p } ` , `node:${ p } ` ] ,
5963 ] )
@@ -92,5 +96,5 @@ export const cloudflare: Preset = {
9296 ] ,
9397 } ,
9498 polyfill : [ ] ,
95- external : cloudflareNodeCompatModules . flatMap ( ( p ) => [ p , `node:${ p } ` ] ) ,
99+ external : nodeCompatModules . flatMap ( ( p ) => [ p , `node:${ p } ` ] ) ,
96100} ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import assert from "node:assert";
55export const TESTS = {
66 testCryptoGetRandomValues,
77 testImplementsBuffer,
8- testModules ,
8+ testNodeCompatModules ,
99 testUtilImplements,
1010 testPath,
1111 testDns,
@@ -75,7 +75,7 @@ async function testImplementsBuffer() {
7575 assert . strictEqual ( typeof buffer . resolveObjectURL , "function" ) ;
7676}
7777
78- async function testModules ( ) {
78+ async function testNodeCompatModules ( ) {
7979 const module = await import ( "node:module" ) ;
8080 // @ts -expect-error exposed by workerd
8181 const require = module . createRequire ( "/" ) ;
You can’t perform that action at this time.
0 commit comments