-
Notifications
You must be signed in to change notification settings - Fork 203
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 *magic* proxy and add back support for Miniflare#get*()
methods
#639
Commits on Aug 17, 2023
-
This provides the foundations for adding back `Miniflare#get*()` methods. It implements a proxy system, that makes HTTP requests to `workerd` on property access/function calls. Synchronous access/calls are supported too.
Configuration menu - View commit details
-
Copy full SHA for a447741 - Browse repository at this point
Copy the full SHA a447741View commit details -
Implement
Miniflare#getBindings()
Adds back support for `Miniflare#getBindings()` from Miniflare 2. This function returns a copy of the `env` object passed to module workers in Node.js. This could be used with framework dev servers to populate their "platform" objects.
Configuration menu - View commit details
-
Copy full SHA for 102f449 - Browse repository at this point
Copy the full SHA 102f449View commit details -
Implement remaining
Miniflare#get*()
methodsAdds back support for `Miniflare#getCaches()`, `getD1Database()`, `getDurableObjectNamespace()`, `getKVNamespace()`, `getQueueProducer()`, and `getR2Bucket()` from Miniflare 2. Tests will follow in future commits.
Configuration menu - View commit details
-
Copy full SHA for a26adf9 - Browse repository at this point
Copy the full SHA a26adf9View commit details -
Rewrite Cache tests to use proxy
Cache tests previously used custom HTTP endpoints to put/match/delete cached data. With the new `Miniflare#getCaches()` function, we can simplify the tests to use the exact same Cache API as workers.
Configuration menu - View commit details
-
Copy full SHA for 9ca92da - Browse repository at this point
Copy the full SHA 9ca92daView commit details -
D1 tests previously defined a `TestD1Database` stub that made calls to custom HTTP endpoints to perform operations. With the new `Miniflare#getD1Database()` function, we can simplify the unshimmed test using the wrapped binding. Note we still need to use `TestD1Database` for the shimmed tests, as the proxy will only give us a `Fetcher` binding.
Configuration menu - View commit details
-
Copy full SHA for 05691bd - Browse repository at this point
Copy the full SHA 05691bdView commit details -
Add Durable Object tests for proxy
Tests the synchronous Durable Object ID creation methods, and performing a WebSocket upgrade on a proxied Durable Object stub.
Configuration menu - View commit details
-
Copy full SHA for 28d9406 - Browse repository at this point
Copy the full SHA 28d9406View commit details -
R2 tests previously defined a bunch of `Test*` stubs that made requests to custom HTTP endpoints and used custom JSON replacers/ revivers to encode R2 objects. With the new `Miniflare#getR2Bucket()` function, we can delete a lot of this code, and just use the proxy.
Configuration menu - View commit details
-
Copy full SHA for b78c755 - Browse repository at this point
Copy the full SHA b78c755View commit details -
Add additional tests for proxy
Adds a few more tests for proxy edge cases, like WebSocket upgrades with service bindings and calling with multiple stream/blob arguments.
Configuration menu - View commit details
-
Copy full SHA for 3e90c0c - Browse repository at this point
Copy the full SHA 3e90c0cView commit details -
...to try and improve test stability. This isn't ideal, but hopefully it should fix some of the flakiness we're seeing. We can investigate this further later.
Configuration menu - View commit details
-
Copy full SHA for 4ca1950 - Browse repository at this point
Copy the full SHA 4ca1950View commit details -
This change throws an uncaught exception if we forget to consume a response body in a test. Unconsumed bodies may cause `undici` to hang or throw socket errors.
Configuration menu - View commit details
-
Copy full SHA for df5e518 - Browse repository at this point
Copy the full SHA df5e518View commit details -
Configuration menu - View commit details
-
Copy full SHA for fb01b1a - Browse repository at this point
Copy the full SHA fb01b1aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5455ed2 - Browse repository at this point
Copy the full SHA 5455ed2View commit details -
Automatically substitute Workers types for Node equivalents
Declares a `ReplaceWorkersTypes` type instead of manually declaring types for each of the Workers APIs.
Configuration menu - View commit details
-
Copy full SHA for 38e067d - Browse repository at this point
Copy the full SHA 38e067dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 62c842e - Browse repository at this point
Copy the full SHA 62c842eView commit details