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
[Miniflare 3] Implement simulators as Durable Objects #656
Commits on Sep 5, 2023
-
Move some shared helpers into
workers
directoryThese will be needed when we port simulators to workers.
Configuration menu - View commit details
-
Copy full SHA for d363e7e - Browse repository at this point
Copy the full SHA d363e7eView commit details -
Implement fake timers for Workers
These were previously implemented in Node, but we'll need them in Durable Objects to aid with testing.
Configuration menu - View commit details
-
Copy full SHA for b1f5bd6 - Browse repository at this point
Copy the full SHA b1f5bd6View commit details -
Implement SQL helpers for Workers
These provide a similar API to what we had with `better-sqlite3`.
Configuration menu - View commit details
-
Copy full SHA for fe6b263 - Browse repository at this point
Copy the full SHA fe6b263View commit details -
Implement decorator router for Workers
This will allow us to use HTTP method decorators like `@GET` in our Durable Object simulators.
Configuration menu - View commit details
-
Copy full SHA for ae5c947 - Browse repository at this point
Copy the full SHA ae5c947View commit details -
Implement blob store for Workers
This implements the same blob store API we previously had in Node, but backed by a `workerd` disk directory service instead.
Configuration menu - View commit details
-
Copy full SHA for ed23f7e - Browse repository at this point
Copy the full SHA ed23f7eView commit details -
Implement simulator Durable Object base class
Implements a `MiniflareDurableObject` class that provides router, storage and fake timer APIs similar to Miniflare's existing ones.
Configuration menu - View commit details
-
Copy full SHA for 5d08f29 - Browse repository at this point
Copy the full SHA 5d08f29View commit details -
Implement expiring key-value-metadata store for Workers
This will be used as the base for KV and Cache simulators.
Configuration menu - View commit details
-
Copy full SHA for 48b0d3a - Browse repository at this point
Copy the full SHA 48b0d3aView commit details -
Implement
miniflare:shared
andminiflare:zod
extensionsThis implements 2 `workerd` "extensions": modules that can be imported by any other worker. `miniflare:shared` contains a bunch of helpers, including the Durable Object base class. `miniflare:zod` includes `zod` and a few useful schemas. `zod` is a relatively large library, so we'd only like to include it in the config once. Not all simulators will depend on it too, so it's separated from `miniflare:shared`. Miniflare's build script has been updated to write embedded Workers to files, that are lazily read as required. `esbuild`'s support for `tsconfig` paths is used to load `miniflare:zod` in Node.js code too.
Configuration menu - View commit details
-
Copy full SHA for 95d1d6f - Browse repository at this point
Copy the full SHA 95d1d6fView commit details -
Implement simple Worker testing
This implements an AVA macro for a test that should run within `workerd`. This allows us to test functionality ported to Workers.
Configuration menu - View commit details
-
Copy full SHA for c02e0f5 - Browse repository at this point
Copy the full SHA c02e0f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9da64f - Browse repository at this point
Copy the full SHA b9da64fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4670191 - Browse repository at this point
Copy the full SHA 4670191View commit details -
Implement generic logging endpoint in loopback server
This replaces the loopback server's support for logging requests with a more generic endpoint, that supports logging any arbitrary message. This will be needed by Durable Object simulators that want to write to the console, without `workerd`'s verbose prefixing. In particular, Queues logs dispatches, and Cache logs first usage when the `cacheWarnUsage` option is enabled.
Configuration menu - View commit details
-
Copy full SHA for 6b40ad3 - Browse repository at this point
Copy the full SHA 6b40ad3View commit details -
Previously, we were only testing the `KVGateway`. In preparation for porting the KV implementation to a worker, rewrite the tests to test the full KV flow, including the router.
Configuration menu - View commit details
-
Copy full SHA for e1b4a74 - Browse repository at this point
Copy the full SHA e1b4a74View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f47465 - Browse repository at this point
Copy the full SHA 4f47465View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64b8232 - Browse repository at this point
Copy the full SHA 64b8232View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7405f88 - Browse repository at this point
Copy the full SHA 7405f88View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8b195af - Browse repository at this point
Copy the full SHA 8b195afView commit details -
Configuration menu - View commit details
-
Copy full SHA for efbecb0 - Browse repository at this point
Copy the full SHA efbecb0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a95517 - Browse repository at this point
Copy the full SHA 3a95517View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6b1288c - Browse repository at this point
Copy the full SHA 6b1288cView commit details -
...and move dependencies only used in Workers to `devDependencies`. They're bundled in with the Worker code, so don't need to be installed again. Importantly, this change removes `better-sqlite3`, meaning Miniflare no longer has any native dependencies other than `workerd`. Fixes #599 Fixes cloudflare/workers-sdk#3423 Fixes cloudflare/workers-sdk#3449 Fixes cloudflare/workers-sdk#3531 Fixes cloudflare/workers-sdk#3534 Fixes cloudflare/workers-sdk#3708 Fixes cloudflare/workers-sdk#3746 Closes cloudflare/cloudflare-docs#10241
Configuration menu - View commit details
-
Copy full SHA for 518ebb0 - Browse repository at this point
Copy the full SHA 518ebb0View commit details -
Use single connection
Client
dispatcherWhen combined with running tests in serial, this should ensure we only have at most two TCP connections open to `workerd` at a time.
Configuration menu - View commit details
-
Copy full SHA for 7ff9dd6 - Browse repository at this point
Copy the full SHA 7ff9dd6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 309673d - Browse repository at this point
Copy the full SHA 309673dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 20583ab - Browse repository at this point
Copy the full SHA 20583abView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4b4dc30 - Browse repository at this point
Copy the full SHA 4b4dc30View commit details