26
26
27
27
LOG = logging .getLogger (__name__ )
28
28
29
- # identifier for default version installed by package installer
30
- DEFAULT_VERSION = "latest"
29
+ # Identifier for default version of `wrangler` installed by package installer.
30
+ # Note: Currently pinned to 3.1.0, as newer versions make the invocations hang in the LS container
31
+ WRANGLER_VERSION = "3.1.0"
31
32
32
33
33
34
class MiniflareExtension (Extension ):
@@ -36,6 +37,10 @@ class MiniflareExtension(Extension):
36
37
def update_gateway_routes (self , router : http .Router [http .RouteHandler ]):
37
38
from miniflare .config import HANDLER_PATH_MINIFLARE
38
39
40
+ logging .getLogger ("miniflare" ).setLevel (
41
+ logging .DEBUG if config .DEBUG else logging .INFO
42
+ )
43
+
39
44
LOG .info ("miniflare: adding routes to activate extension" )
40
45
all_methods = ["GET" , "POST" , "PUT" , "DELETE" ]
41
46
@@ -83,7 +88,7 @@ def __init__(self, script: WorkerScript, port: int):
83
88
super ().__init__ (port )
84
89
85
90
def do_run (self ):
86
- root_dir = os .path .join (config .dirs .var_libs , "miniflare" , DEFAULT_VERSION )
91
+ root_dir = os .path .join (config .dirs .var_libs , "miniflare" , WRANGLER_VERSION )
87
92
wrangler_bin = os .path .join (root_dir , "node_modules" , ".bin" , "wrangler" )
88
93
89
94
# add global aliases, and variable bindings
@@ -102,7 +107,6 @@ def do_run(self):
102
107
cmd = [
103
108
wrangler_bin ,
104
109
"dev" ,
105
- "--experimental-local" ,
106
110
"--port" ,
107
111
str (self .port ),
108
112
script_path_final ,
@@ -115,7 +119,7 @@ def do_run(self):
115
119
116
120
class MiniflareInstaller (ExecutableInstaller ):
117
121
def __init__ (self ):
118
- super ().__init__ ("miniflare" , version = DEFAULT_VERSION )
122
+ super ().__init__ ("miniflare" , version = WRANGLER_VERSION )
119
123
120
124
def _get_install_marker_path (self , install_dir : str ) -> str :
121
125
# force re-install on every start (requires npm package + system libs like libc++)
@@ -134,5 +138,4 @@ def _install(self, target: InstallTarget) -> None:
134
138
run (["apt" , "install" , "-y" , "libc++-dev" ])
135
139
136
140
# install npm package
137
- run (["npm" , "install" , "--prefix" , target_dir , "wrangler" ])
138
- run (["npm" , "install" , "--prefix" , target_dir , "@miniflare/tre" ])
141
+ run (["npm" , "install" , "--prefix" , target_dir , f"wrangler@{ WRANGLER_VERSION } " ])
0 commit comments