Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bumpy-mice-follow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/unenv-preset": patch
---

Remove experimental from the enable_nodejs_http_server_modules flag
2 changes: 1 addition & 1 deletion packages/unenv-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"peerDependencies": {
"unenv": "2.0.0-rc.19",
"workerd": "^1.20250802.0"
"workerd": "^1.20250816.0"
},
"peerDependenciesMeta": {
"workerd": {
Expand Down
12 changes: 7 additions & 5 deletions packages/unenv-preset/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,20 @@ function getHttpOverrides({
return { nativeModules: [], hybridModules: [] };
}

const httpServerEnabledByFlag =
compatibilityFlags.includes("enable_nodejs_http_server_modules") &&
compatibilityFlags.includes("experimental");
const httpServerEnabledByFlag = compatibilityFlags.includes(
"enable_nodejs_http_server_modules"
);

const httpServerDisabledByFlag = compatibilityFlags.includes(
"disable_nodejs_http_server_modules"
);

const httpServerEnabledByDate = compatibilityDate >= "2025-09-01";

// Note that `httpServerEnabled` requires `httpEnabled`
// TODO: add `httpServerEnabledByDate` when a default date is set
const httpServerEnabled =
httpServerEnabledByFlag && !httpServerDisabledByFlag;
(httpServerEnabledByFlag || httpServerEnabledByDate) &&
!httpServerDisabledByFlag;

// Override unenv base aliases with native and hybrid modules
// `node:https` is fully implemented by workerd if both flags are enabled
Expand Down
28 changes: 15 additions & 13 deletions packages/wrangler/e2e/unenv-preset/preset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,62 +33,64 @@ const testConfigs: TestConfig[] = [
[
{
name: "http disabled by date",
compatibilityDate: "2025-07-26",
compatibilityDate: "2024-09-23",
expectRuntimeFlags: {
enable_nodejs_http_modules: false,
},
},
{
name: "http disabled by flag",
// TODO: use a date when http is enabled by default (> 2025-08-15)
compatibilityDate: "2025-07-26",
compatibilityDate: "2025-08-15",
compatibilityFlags: ["disable_nodejs_http_modules"],
expectRuntimeFlags: {
enable_nodejs_http_modules: false,
},
},
// TODO: add a config when http is enabled by default (> 2025-08-15)
{
name: "http enabled by flag",
compatibilityDate: "2025-07-26",
compatibilityDate: "2024-09-23",
compatibilityFlags: ["enable_nodejs_http_modules"],
expectRuntimeFlags: {
enable_nodejs_http_modules: true,
},
},
{
name: "http enabled by date",
compatibilityDate: "2025-08-15",
expectRuntimeFlags: {
enable_nodejs_http_modules: true,
},
},
],
// http client and server modules
[
{
name: "http server disabled by date",
compatibilityDate: "2025-07-26",
compatibilityFlags: ["experimental"],
compatibilityDate: "2024-09-23",
expectRuntimeFlags: {
enable_nodejs_http_modules: false,
},
},
// TODO: add a config when http server is enabled by default (date no set yet)
// TODO: add a config when http server is enabled by default (>= 2025-09-01)
{
name: "http server enabled by flag",
compatibilityDate: "2025-07-26",
compatibilityDate: "2024-09-23",
compatibilityFlags: [
"enable_nodejs_http_modules",
"enable_nodejs_http_server_modules",
"experimental",
],
expectRuntimeFlags: {
enable_nodejs_http_modules: true,
enable_nodejs_http_server_modules: true,
},
},
// TODO: change the date pass the default enabled date (date not set yet)
// TODO: change the date pass the default enabled date (>= 2025-09-01)
{
name: "http server disabled by flag",
compatibilityDate: "2025-07-26",
compatibilityDate: "2024-09-23",
compatibilityFlags: [
"enable_nodejs_http_modules",
"disable_nodejs_http_server_modules",
"experimental",
],
expectRuntimeFlags: {
enable_nodejs_http_modules: true,
Expand Down
62 changes: 2 additions & 60 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading