Skip to content

Commit 2ef31a9

Browse files
authored
bump @cloudflare/unenv-preset (#9221)
* bump @cloudflare/unenv-preset * fixup! add more tests * fixup! 2.3.2 + changeset
1 parent 3b8f7f1 commit 2ef31a9

7 files changed

Lines changed: 76 additions & 14 deletions

File tree

.changeset/olive-candies-nail.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@cloudflare/vite-plugin": patch
3+
"wrangler": patch
4+
---
5+
6+
bump `@cloudflare/unenv-preset`

fixtures/nodejs-hybrid-app/src/index.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default {
3434
return await testTls();
3535
case "/test-crypto":
3636
return await testCrypto();
37+
case "/test-sqlite":
38+
return await testSqlite();
39+
case "/test-http":
40+
return await testHttp();
3741
}
3842

3943
return new Response(
@@ -45,6 +49,8 @@ export default {
4549
<a href="test-immediate">Test setImmediate</a>
4650
<a href="test-tls">node:tls</a>
4751
<a href="test-crypto">node:crypto</a>
52+
<a href="test-sqlite">node:sqlite</a>
53+
<a href="test-http">node:http</a>
4854
`,
4955
{ headers: { "Content-Type": "text/html; charset=utf-8" } }
5056
);
@@ -140,6 +146,9 @@ function testBasicNodejsProperties() {
140146
}
141147

142148
function testProcessBehavior() {
149+
assert.strictEqual(typeof process.version, "string");
150+
assert.strictEqual(typeof process.versions.node, "string");
151+
143152
const originalProcess = process;
144153
try {
145154
assert.notEqual(process, undefined);
@@ -219,6 +228,8 @@ async function testTls() {
219228
true
220229
);
221230

231+
assert.strictEqual(typeof tls.convertALPNProtocols, "function");
232+
222233
return new Response("OK");
223234
}
224235

@@ -241,3 +252,20 @@ async function testCrypto() {
241252

242253
return new Response("OK");
243254
}
255+
256+
async function testSqlite() {
257+
const sqlite = await import("node:sqlite");
258+
259+
assert.strictEqual(typeof sqlite.DatabaseSync, "function");
260+
261+
return new Response("OK");
262+
}
263+
264+
async function testHttp() {
265+
const http = await import("node:http");
266+
267+
const agent = new http.Agent();
268+
assert.strictEqual(typeof agent.options, "object");
269+
270+
return new Response("OK");
271+
}

fixtures/nodejs-hybrid-app/tests/index.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,16 @@ describe("nodejs compat", () => {
7676
const response = await fetch(`http://${ip}:${port}/test-crypto`);
7777
await expect(response.text()).resolves.toBe("OK");
7878
});
79+
80+
test("node:sqlite", async ({ expect }) => {
81+
const { ip, port } = wrangler;
82+
const response = await fetch(`http://${ip}:${port}/test-sqlite`);
83+
await expect(response.text()).resolves.toBe("OK");
84+
});
85+
86+
test("node:http", async ({ expect }) => {
87+
const { ip, port } = wrangler;
88+
const response = await fetch(`http://${ip}:${port}/test-http`);
89+
await expect(response.text()).resolves.toBe("OK");
90+
});
7991
});

packages/unenv-preset/tests/worker/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const TESTS = {
1111
testDns,
1212
testTimers,
1313
testNet,
14+
testTls,
1415
};
1516

1617
export default {
@@ -168,3 +169,9 @@ export async function testNet() {
168169
assert.strictEqual(typeof net.createConnection, "function");
169170
assert.throws(() => net.createServer(), /not implemented/);
170171
}
172+
173+
export async function testTls() {
174+
const tls = await import("node:tls");
175+
assert.strictEqual(typeof tls, "object");
176+
assert.strictEqual(typeof tls.convertALPNProtocols, "function");
177+
}

packages/vite-plugin-cloudflare/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
"test:watch": "vitest"
4343
},
4444
"dependencies": {
45-
"@cloudflare/unenv-preset": "2.3.1",
45+
"@cloudflare/unenv-preset": "2.3.2",
4646
"@mjackson/node-fetch-server": "^0.6.1",
4747
"@rollup/plugin-replace": "^6.0.1",
4848
"get-port": "^7.1.0",
4949
"miniflare": "workspace:*",
5050
"picocolors": "^1.1.1",
5151
"tinyglobby": "^0.2.12",
52-
"unenv": "2.0.0-rc.15",
52+
"unenv": "2.0.0-rc.17",
5353
"wrangler": "workspace:*",
5454
"ws": "catalog:default"
5555
},

packages/wrangler/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@
6969
},
7070
"dependencies": {
7171
"@cloudflare/kv-asset-handler": "workspace:*",
72-
"@cloudflare/unenv-preset": "2.3.1",
72+
"@cloudflare/unenv-preset": "2.3.2",
7373
"blake3-wasm": "2.1.5",
7474
"esbuild": "catalog:default",
7575
"miniflare": "workspace:*",
7676
"path-to-regexp": "6.3.0",
77-
"unenv": "2.0.0-rc.15",
77+
"unenv": "2.0.0-rc.17",
7878
"workerd": "1.20250508.0"
7979
},
8080
"devDependencies": {

pnpm-lock.yaml

Lines changed: 19 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)