chore: import upstream snapshot with attribution
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:30:11 +08:00
commit 70bf21e064
5213 changed files with 731895 additions and 0 deletions
@@ -0,0 +1,2 @@
declare let performance: Performance;
declare let Performance: typeof Performance;
@@ -0,0 +1,46 @@
import assert from "node:assert/strict";
import { join } from "node:path";
// Check that we can actually import unenv polyfilled modules in user source.
import "node:perf_hooks";
// Check that `cloudflare:worker` imports work when `nodejs_compat` is enabled
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
export class MyWorkerEntrypoint extends WorkerEntrypoint {}
export class MyDurableObject extends DurableObject {}
export default {
async fetch() {
return testBasicNodejsProperties();
},
} satisfies ExportedHandler;
function testBasicNodejsProperties() {
assert(true, "the world is broken");
assert(join("a", "b") === "a/b", "expected posix path joining");
const buffer1 = Buffer.of(1);
assert(buffer1.toJSON().data[0] === 1, "Buffer is broken");
const buffer2 = global.Buffer.of(1);
assert(buffer2.toJSON().data[0] === 1, "global.Buffer is broken");
const buffer3 = globalThis.Buffer.of(1);
assert(buffer3.toJSON().data[0] === 1, "globalThis.Buffer is broken");
assert(performance !== undefined, "performance is missing");
assert(global.performance !== undefined, "global.performance is missing");
assert(
globalThis.performance !== undefined,
"globalThis.performance is missing"
);
assert(Performance !== undefined, "Performance is missing");
assert(global.Performance !== undefined, "global.Performance is missing");
assert(
globalThis.Performance !== undefined,
"globalThis.Performance is missing"
);
return new Response(`"OK!"`);
}
@@ -0,0 +1,27 @@
{
"name": "worker",
"main": "./index.ts",
"compatibility_date": "2024-12-30",
"compatibility_flags": ["nodejs_compat"],
"services": [
{
"binding": "MY_SERVICE",
"service": "worker",
"entrypoint": "MyWorkerEntrypoint",
},
],
"durable_objects": {
"bindings": [
{
"name": "MY_DO",
"class_name": "MyDurableObject",
},
],
},
"migrations": [
{
"tag": "v1",
"new_classes": ["MyDurableObject"],
},
],
}