<p dir="auto">Hi.<br>
I'm trying to speed up my framework, so I decided to rewrite the process of loading dynamic typescript files.<br>
Old code:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let loadedFiles = [];
for await(const dirEntry of Deno.readDir( targetDirectory )){
    loadedFiles.push(await import(path.join(targetDirectory, dirEntry.name)));
}"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">loadedFiles</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-k">for</span> <span class="pl-k">await</span><span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">dirEntry</span> <span class="pl-k">of</span> <span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">readDir</span><span class="pl-kos">(</span> <span class="pl-s1">targetDirectory</span> <span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-s1">loadedFiles</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-k">await</span> <span class="pl-k">import</span><span class="pl-kos">(</span><span class="pl-s1">path</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s1">targetDirectory</span><span class="pl-kos">,</span> <span class="pl-s1">dirEntry</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This method takes a long time to load all files from directory. I need to wait 7-10sec to load all (precompiled) files.<br>
Today I realized that I can load it like this:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="let promises = [];
for await(const dirEntry of Deno.readDir( targetDirectory )){
    loadedFiles.push(await import(path.join(targetDirectory, dirEntry.name)));
}
await Promise.all(promises).then((loadedFiles)=&gt;{ ... });"><pre class="notranslate"><span class="pl-k">let</span> <span class="pl-s1">promises</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-k">for</span> <span class="pl-k">await</span><span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">dirEntry</span> <span class="pl-k">of</span> <span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">readDir</span><span class="pl-kos">(</span> <span class="pl-s1">targetDirectory</span> <span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
    <span class="pl-s1">loadedFiles</span><span class="pl-kos">.</span><span class="pl-en">push</span><span class="pl-kos">(</span><span class="pl-k">await</span> <span class="pl-k">import</span><span class="pl-kos">(</span><span class="pl-s1">path</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s1">targetDirectory</span><span class="pl-kos">,</span> <span class="pl-s1">dirEntry</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-k">await</span> <span class="pl-smi">Promise</span><span class="pl-kos">.</span><span class="pl-en">all</span><span class="pl-kos">(</span><span class="pl-s1">promises</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-s1">loadedFiles</span><span class="pl-kos">)</span><span class="pl-c1">=&gt;</span><span class="pl-kos">{</span> ... <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">But deno throws error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Cannot resolve module &quot;./rsa_internal.ts&quot; from &quot;https://deno.land/x/god_crypto@v1.4.9/src/rsa/rsa_js.ts&quot;"><pre class="notranslate">Cannot resolve module <span class="pl-s"><span class="pl-pds">"</span>./rsa_internal.ts<span class="pl-pds">"</span></span> from <span class="pl-s"><span class="pl-pds">"</span>https://deno.land/x/god_crypto@v1.4.9/src/rsa/rsa_js.ts<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">I tried to change lib but unfortunatelly also throws error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Cannot resolve module &quot;https://denopkg.com/chiefbiiko/std-encoding@v1.1.1/mod.ts&quot; from &quot;https://deno.land/x/hmac@v2.0.1/deps.ts&quot;"><pre class="notranslate">Cannot resolve module <span class="pl-s"><span class="pl-pds">"</span>https://denopkg.com/chiefbiiko/std-encoding@v1.1.1/mod.ts<span class="pl-pds">"</span></span> from <span class="pl-s"><span class="pl-pds">"</span>https://deno.land/x/hmac@v2.0.1/deps.ts<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">Attempting to log the <code class="notranslate">Request</code> object from a native server http request event results in an error thrown from the request / console op_crates.</p>
<p dir="auto">Taken from <code class="notranslate">v1.9</code> blog example with minor adjustment to expose and attempt to log the <code class="notranslate">request</code>:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const body = new TextEncoder().encode(&quot;Hello World&quot;);
for await (const conn of Deno.listen({ port: 4500 })) {
  (async () =&gt; {
    for await (const { request, respondWith } of Deno.serveHttp(conn)) {
      console.log(request); // 💥
      await respondWith(new Response(body));
    }
  })();
}"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">body</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">TextEncoder</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">encode</span><span class="pl-kos">(</span><span class="pl-s">"Hello World"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">for</span> <span class="pl-k">await</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-s1">conn</span> <span class="pl-k">of</span> <span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">listen</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">port</span>: <span class="pl-c1">4500</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-kos">(</span><span class="pl-k">async</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">for</span> <span class="pl-k">await</span> <span class="pl-kos">(</span><span class="pl-k">const</span> <span class="pl-kos">{</span> request<span class="pl-kos">,</span> respondWith <span class="pl-kos">}</span> <span class="pl-k">of</span> <span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">serveHttp</span><span class="pl-kos">(</span><span class="pl-s1">conn</span><span class="pl-kos">)</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">request</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// 💥</span>
      <span class="pl-k">await</span> <span class="pl-en">respondWith</span><span class="pl-kos">(</span><span class="pl-k">new</span> <span class="pl-smi">Response</span><span class="pl-kos">(</span><span class="pl-s1">body</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Run and then make a request to <code class="notranslate">http://localhost:4500</code>:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ deno run --unstable -A ./repro.ts
error: Uncaught (in promise) TypeError: this.url is not a function
      console.log(request);
              ^
    at Request.[Deno.customInspect] (deno:op_crates/fetch/23_request.js:395:19)
    at inspectObject (deno:op_crates/console/02_console.js:925:50)
    at inspectValue (deno:op_crates/console/02_console.js:481:16)
    at inspectArgs (deno:op_crates/console/02_console.js:1454:19)
    at console.log (deno:op_crates/console/02_console.js:1504:9)
    at ..."><pre class="notranslate">$ <span class="pl-s1">deno run --unstable -A ./repro.ts</span>
<span class="pl-c1">error: Uncaught (in promise) TypeError: this.url is not a function</span>
<span class="pl-c1">      console.log(request);</span>
<span class="pl-c1">              ^</span>
<span class="pl-c1">    at Request.[Deno.customInspect] (deno:op_crates/fetch/23_request.js:395:19)</span>
<span class="pl-c1">    at inspectObject (deno:op_crates/console/02_console.js:925:50)</span>
<span class="pl-c1">    at inspectValue (deno:op_crates/console/02_console.js:481:16)</span>
<span class="pl-c1">    at inspectArgs (deno:op_crates/console/02_console.js:1454:19)</span>
<span class="pl-c1">    at console.log (deno:op_crates/console/02_console.js:1504:9)</span>
<span class="pl-c1">    at ...</span></pre></div>
<p dir="auto">Expected behaviour is that consumers should be able to log the request, or parts therein without an exception being thrown.</p>