<p dir="auto">Currently we have two different dispatch mechanism implemented:</p>
<ul dir="auto">
<li>minimal - used for io ops (<code class="notranslate">op_read</code> and <code class="notranslate">op_write</code>)</li>
<li>JSON - used for all other ops</li>
</ul>
<p dir="auto">Each of these mechanism has separate promise table that is used to store promises awaiting response from Rust.</p>
<p dir="auto">Duplication should be removed and only promise table should be managed by <code class="notranslate">Deno.core</code> namespace.</p>
<p dir="auto">Can it be useful to add importer informations on import.meta for better logs (and errors) ? For instance, a multiple times imported module can log contextualized messages (eg.: <a href="https://github.com/JOTSR/ensure_version/blob/275d8f1213bc6b3f8b85f5a267d814a4f5014b09/ensure_version.ts#L123">in version checker to indicate which module require a specific version</a> ).</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import.meta.importer = {
    url: 'importer/url',
    main: true
}"><pre class="notranslate"><span class="pl-k">import</span><span class="pl-kos">.</span><span class="pl-c1">meta</span><span class="pl-kos">.</span><span class="pl-c1">importer</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">url</span>: <span class="pl-s">'importer/url'</span><span class="pl-kos">,</span>
    <span class="pl-c1">main</span>: <span class="pl-c1">true</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Maybe it can be recursive to get imports chain for some usages</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import.meta.importer = {
   url: '...',
   main: ... ,
   importer: { ... }
}"><pre class="notranslate"><span class="pl-k">import</span><span class="pl-kos">.</span><span class="pl-c1">meta</span><span class="pl-kos">.</span><span class="pl-c1">importer</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
   <span class="pl-c1">url</span>: <span class="pl-s">'...'</span><span class="pl-kos">,</span>
   <span class="pl-c1">main</span>: ... <span class="pl-kos">,</span>
   <span class="pl-c1">importer</span>: <span class="pl-kos">{</span> ... <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">For main module, importer should be set to <code class="notranslate">null</code><br>
Maybe Deno.mainModule should be moved (or duplicate since import.meta is not accessible outside of modules, eg: REPL) to</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import.meta.mainModule = {
   url: '...',
   main: true,
   importer: null //maybe undefined or refers to itself
}"><pre class="notranslate"><span class="pl-k">import</span><span class="pl-kos">.</span><span class="pl-c1">meta</span><span class="pl-kos">.</span><span class="pl-c1">mainModule</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
   <span class="pl-c1">url</span>: <span class="pl-s">'...'</span><span class="pl-kos">,</span>
   <span class="pl-c1">main</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
   <span class="pl-c1">importer</span>: <span class="pl-c1">null</span> <span class="pl-c">//maybe undefined or refers to itself</span>
<span class="pl-kos">}</span></pre></div>