Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update unenv dependency version #6782

Merged
merged 2 commits into from
Sep 20, 2024
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/lucky-doors-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

chore: update unenv dependency version
44 changes: 34 additions & 10 deletions fixtures/nodejs-hybrid-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,51 @@ export default {
ctx: ExecutionContext
): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/test-random") {
return testGetRandomValues();
}

if (url.pathname === "/test-process") {
return testProcessBehaviour();
}

if (url.pathname === "/query") {
return testPostgresLibrary(env, ctx);
switch (url.pathname) {
case "/test-random":
return testGetRandomValues();
case "/test-process":
return testProcessBehaviour();
case "/query":
return testPostgresLibrary(env, ctx);
case "/test-x509-certificate":
return testX509Certificate();
}

return new Response(
'<a href="query">Postgres query</a> | ' +
'<a href="test-process">Test process global</a> | ' +
'<a href="test-random">Test getRandomValues()</a> | ',
'<a href="test-random">Test getRandomValues()</a> | ' +
'<a href="test-x509-certificate">Test X509Certificate</a>',
{ headers: { "Content-Type": "text/html; charset=utf-8" } }
);
},
};

function testX509Certificate() {
try {
new nodeCrypto.X509Certificate(`-----BEGIN CERTIFICATE-----
MIICZjCCAc+gAwIBAgIUOsv8Y+x40C+gdNuu40N50KpGUhEwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA5MjAwOTA4MTNaFw0yNTA5
MjAwOTA4MTNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwgZ8wDQYJKoZIhvcNAQEB
BQADgY0AMIGJAoGBALpJn3dUrNmZhZV02RbjZKTd5j3hpgTncF4lG4Y3sQA18k0l
7pt6xpZuXYSFH7v2zTAxYy+uYyYwX2NZur48dZc76FSzIeuQdoTCkT0NacwFRTR5
fEEqPvvB85ozYuyk8Bl3vSsonivOH3WftEDp9mjkHROQzS4wAZbIj7Cp+is/AgMB
AAGjUzBRMB0GA1UdDgQWBBSzFJSiPAw2tJOg8oUXrFBdqWI6zDAfBgNVHSMEGDAW
gBSzFJSiPAw2tJOg8oUXrFBdqWI6zDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3
DQEBCwUAA4GBACbto0+Ds40F7faRFFMwg5nPyh7gsiX+ZK3FYcrO3oxh5ejfzwow
DKOOje4Ncaw0rIkVpxacPyjg+wANuK2Nv/Z4CVAD3mneE4gwgRdn38q8IYN9AtSv
GzEf4UxiLBbUB6WRBgyVyquGfUMlKl/tnm4q0yeYQloYKSoHpGeHVJuN
-----END CERTIFICATE-----`);
return new Response(`"OK!"`);
} catch {
return new Response(`"KO!"`);
}
}

function testGetRandomValues() {
assert(
webcrypto.getRandomValues === getRandomValues,
Expand Down
17 changes: 16 additions & 1 deletion fixtures/nodejs-hybrid-app/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolve } from "node:path";
import { fetch } from "undici";
import { describe, it } from "vitest";
import { describe, it, test } from "vitest";
import { runWranglerDev } from "../../shared/src/run-wrangler-long-lived";

describe("nodejs compat", () => {
Expand Down Expand Up @@ -48,4 +48,19 @@ describe("nodejs compat", () => {
await stop();
}
});

test("crypto.X509Certificate is implemented", async ({ expect }) => {
vicb marked this conversation as resolved.
Show resolved Hide resolved
const { ip, port, stop } = await runWranglerDev(
resolve(__dirname, "../src"),
["--port=0", "--inspector-port=0"]
);
try {
const response = await fetch(
`http://${ip}:${port}/test-x509-certificate`
);
await expect(response.text()).resolves.toBe(`"OK!"`);
} finally {
await stop();
}
});
});
2 changes: 1 addition & 1 deletion packages/wrangler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"resolve.exports": "^2.0.2",
"selfsigned": "^2.0.1",
"source-map": "^0.6.1",
"unenv": "npm:[email protected]1726478054.1e87097",
"unenv": "npm:[email protected]20240919-125358-9a64854",
"workerd": "1.20240909.0",
"xxhash-wasm": "^1.0.1"
},
Expand Down
24 changes: 15 additions & 9 deletions pnpm-lock.yaml

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

Loading