Skip to content

Commit 19e2aab

Browse files
authored
remove node:tls polyfills (#10432)
1 parent c4fd176 commit 19e2aab

File tree

4 files changed

+21
-64
lines changed

4 files changed

+21
-64
lines changed

.changeset/fancy-badgers-build.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@cloudflare/unenv-preset": patch
3+
"wrangler": patch
4+
---
5+
6+
Remove "node:tls" polyfill

packages/unenv-preset/src/preset.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ const nativeModules = [
3737
"string_decoder",
3838
"timers",
3939
"timers/promises",
40+
"tls",
4041
"url",
4142
"util/types",
4243
"zlib",
4344
];
4445

4546
// Modules implemented via a mix of workerd APIs and polyfills.
46-
const hybridModules = ["console", "crypto", "module", "process", "tls", "util"];
47+
const hybridModules = ["console", "crypto", "module", "process", "util"];
4748

4849
/**
4950
* Creates the Cloudflare preset for the given compatibility date and compatibility flags

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

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

packages/wrangler/e2e/unenv-preset/worker/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,19 @@ export const WorkerdTests: Record<string, () => void> = {
201201
assert.strictEqual(typeof tls, "object");
202202
// @ts-expect-error Node types are wrong
203203
assert.strictEqual(typeof tls.convertALPNProtocols, "function");
204+
assert.strictEqual(typeof tls.createSecureContext, "function");
205+
assert.strictEqual(typeof tls.createServer, "function");
206+
assert.strictEqual(typeof tls.checkServerIdentity, "function");
207+
assert.strictEqual(typeof tls.getCiphers, "function");
208+
209+
// Test constants
210+
assert.strictEqual(typeof tls.CLIENT_RENEG_LIMIT, "number");
211+
assert.strictEqual(typeof tls.CLIENT_RENEG_WINDOW, "number");
212+
assert.strictEqual(typeof tls.DEFAULT_ECDH_CURVE, "string");
213+
assert.strictEqual(typeof tls.DEFAULT_CIPHERS, "string");
214+
assert.strictEqual(typeof tls.DEFAULT_MIN_VERSION, "string");
215+
assert.strictEqual(typeof tls.DEFAULT_MAX_VERSION, "string");
216+
assert.ok(Array.isArray(tls.rootCertificates));
204217
},
205218

206219
async testHttp() {

0 commit comments

Comments
 (0)