Skip to content

Commit fd73b69

Browse files
authored
refactor http modules polyfill (#10542)
1 parent 6e8dd80 commit fd73b69

File tree

3 files changed

+6
-105
lines changed

3 files changed

+6
-105
lines changed

packages/unenv-preset/src/preset.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,20 @@ function getHttpOverrides({
180180
(httpServerEnabledByFlag || httpServerEnabledByDate) &&
181181
!httpServerDisabledByFlag;
182182

183-
// Override unenv base aliases with native and hybrid modules
184-
// `node:https` is fully implemented by workerd if both flags are enabled
185183
return {
186184
nativeModules: [
187185
"_http_agent",
188186
"_http_client",
189187
"_http_common",
190188
"_http_incoming",
191189
"_http_outgoing",
192-
...(httpServerEnabled ? ["_http_server", "https"] : []),
190+
// `_http_server` can only be imported when the server flag is set
191+
// See https://github.com/cloudflare/workerd/blob/56efc04/src/workerd/api/node/node.h#L102-L106
192+
...(httpServerEnabled ? ["_http_server"] : []),
193+
"http",
194+
"https",
193195
],
194-
hybridModules: httpServerEnabled ? ["http"] : ["http", "https"],
196+
hybridModules: [],
195197
};
196198
}
197199

packages/unenv-preset/src/runtime/node/http.ts

Lines changed: 0 additions & 80 deletions
This file was deleted.

packages/unenv-preset/src/runtime/node/https.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)