Skip to content

Commit 21e9c40

Browse files
committed
Import vendored ASGI bridge statically
1 parent 8f6a2aa commit 21e9c40

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/asgi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
from __future__ import annotations
2+
13
import logging
24
from asyncio import Event, Future, Queue, create_task, ensure_future, sleep
35
from collections.abc import Awaitable
46
from contextlib import contextmanager
57
from inspect import isawaitable
68
from typing import Any
79

8-
import js
9-
1010
from workers import Context, Request
1111

1212
ASGI = {"spec_version": "2.0", "version": "3.0"}

src/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
from asset_manifest import HTML_CACHE_VERSION
1111
from examples import PYTHON_VERSION
1212

13-
if False: # Ensure the Worker bundler includes the ASGI bridge without importing js during local tooling.
14-
import asgi
13+
import asgi
1514

1615
try:
1716
from js import Object, Request as JsRequest, caches
@@ -128,8 +127,6 @@ async def not_found(path: str, request: Request):
128127

129128
class Default(WorkerEntrypoint):
130129
async def fetch(self, request):
131-
import asgi
132-
133130
global _CURRENT_WORKER_REQUEST
134131
_CURRENT_WORKER_REQUEST = request
135132

0 commit comments

Comments
 (0)