<p dir="auto">While the general direction are users moving from NodeJS into Deno, for me, I enjoy Deno modules while working on a bigger NodeJS/TS project that consumes npm packages.</p>
<p dir="auto">I would like to import my Deno modules back into NodeJS while retaining type declaration. Steps that I have to do now are:</p>
<ol dir="auto">
<li>Copy a.. *.ts files to a temp dir.</li>
<li>Remove all <code class="notranslate">.ts</code> from <code class="notranslate">import</code>s .</li>
<li>Recursively resolve all externally loaded modules.</li>
</ol>
<p dir="auto">There's also <code class="notranslate">deno bundle</code>, which is useful, but it does not generate type declaration file. It would be nice if there's <code class="notranslate">deno bundle --declaration</code>, similar to <code class="notranslate">tsc --declaration</code>.</p>
<p dir="auto">What does the community think?</p>
<p dir="auto">Instead of an array like so:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[
  {
    &quot;runtime&quot;: &quot;Deno/1.28.3 x86_64-apple-darwin&quot;,
    &quot;cpu&quot;: &quot;Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz&quot;,
    &quot;origin&quot;: &quot;file:///Users/serhiy.barhamon/tmp/deno/test_ffi/tests/bench.js&quot;,
    &quot;group&quot;: null,
    &quot;name&quot;: &quot;Deno.UnsafePointerView#getUint32&quot;,
    &quot;baseline&quot;: false,
    &quot;result&quot;: {
      &quot;ok&quot;: {
        &quot;n&quot;: 49,
        &quot;min&quot;: 1251.9348,
        &quot;max&quot;: 1441.2696,
        &quot;avg&quot;: 1308.7523755102038,
        &quot;p75&quot;: 1324.1055,
        &quot;p99&quot;: 1441.2696,
        &quot;p995&quot;: 1441.2696,
        &quot;p999&quot;: 1441.2696
      }
    }
  },
  {
    &quot;runtime&quot;: &quot;Deno/1.28.3 x86_64-apple-darwin&quot;,
    &quot;cpu&quot;: &quot;Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz&quot;,
    // ...
  }
]"><pre class="notranslate"><span class="pl-kos">[</span>
  <span class="pl-kos">{</span>
    <span class="pl-s">"runtime"</span>: <span class="pl-s">"Deno/1.28.3 x86_64-apple-darwin"</span><span class="pl-kos">,</span>
    <span class="pl-s">"cpu"</span>: <span class="pl-s">"Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz"</span><span class="pl-kos">,</span>
    <span class="pl-s">"origin"</span>: <span class="pl-s">"file:///Users/serhiy.barhamon/tmp/deno/test_ffi/tests/bench.js"</span><span class="pl-kos">,</span>
    <span class="pl-s">"group"</span>: <span class="pl-c1">null</span><span class="pl-kos">,</span>
    <span class="pl-s">"name"</span>: <span class="pl-s">"Deno.UnsafePointerView#getUint32"</span><span class="pl-kos">,</span>
    <span class="pl-s">"baseline"</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
    <span class="pl-s">"result"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"ok"</span>: <span class="pl-kos">{</span>
        <span class="pl-s">"n"</span>: <span class="pl-c1">49</span><span class="pl-kos">,</span>
        <span class="pl-s">"min"</span>: <span class="pl-c1">1251.9348</span><span class="pl-kos">,</span>
        <span class="pl-s">"max"</span>: <span class="pl-c1">1441.2696</span><span class="pl-kos">,</span>
        <span class="pl-s">"avg"</span>: <span class="pl-c1">1308.7523755102038</span><span class="pl-kos">,</span>
        <span class="pl-s">"p75"</span>: <span class="pl-c1">1324.1055</span><span class="pl-kos">,</span>
        <span class="pl-s">"p99"</span>: <span class="pl-c1">1441.2696</span><span class="pl-kos">,</span>
        <span class="pl-s">"p995"</span>: <span class="pl-c1">1441.2696</span><span class="pl-kos">,</span>
        <span class="pl-s">"p999"</span>: <span class="pl-c1">1441.2696</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-s">"runtime"</span>: <span class="pl-s">"Deno/1.28.3 x86_64-apple-darwin"</span><span class="pl-kos">,</span>
    <span class="pl-s">"cpu"</span>: <span class="pl-s">"Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz"</span><span class="pl-kos">,</span>
    <span class="pl-c">// ...</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">]</span></pre></div>
<p dir="auto">It would probably be better to not duplicate the runtime and cpu for each object and instead do something like:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;version&quot;: 1, // https://github.com/denoland/deno/issues/17774
  &quot;runtime&quot;: &quot;Deno/1.28.3 x86_64-apple-darwin&quot;,
  &quot;cpu&quot;: &quot;Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz&quot;,
  &quot;benches&quot;: [
    {
      &quot;origin&quot;: &quot;file:///Users/serhiy.barhamon/tmp/deno/test_ffi/tests/bench.js&quot;,
      &quot;name&quot;: &quot;Deno.UnsafePointerView#getUint32&quot;,
      &quot;baseline&quot;: false,
      &quot;result&quot;: {
        &quot;n&quot;: 49,
        &quot;min&quot;: 1251.9348,
        &quot;max&quot;: 1441.2696,
        &quot;avg&quot;: 1308.7523755102038,
        &quot;p75&quot;: 1324.1055,
        &quot;p99&quot;: 1441.2696,
        &quot;p995&quot;: 1441.2696,
        &quot;p999&quot;: 1441.2696
      }
    },
    {
      // ..
    }
  ]
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"version"</span>: <span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c">// https://github.com/denoland/deno/issues/17774</span>
  <span class="pl-s">"runtime"</span>: <span class="pl-s">"Deno/1.28.3 x86_64-apple-darwin"</span><span class="pl-kos">,</span>
  <span class="pl-s">"cpu"</span>: <span class="pl-s">"Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz"</span><span class="pl-kos">,</span>
  <span class="pl-s">"benches"</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">{</span>
      <span class="pl-s">"origin"</span>: <span class="pl-s">"file:///Users/serhiy.barhamon/tmp/deno/test_ffi/tests/bench.js"</span><span class="pl-kos">,</span>
      <span class="pl-s">"name"</span>: <span class="pl-s">"Deno.UnsafePointerView#getUint32"</span><span class="pl-kos">,</span>
      <span class="pl-s">"baseline"</span>: <span class="pl-c1">false</span><span class="pl-kos">,</span>
      <span class="pl-s">"result"</span>: <span class="pl-kos">{</span>
        <span class="pl-s">"n"</span>: <span class="pl-c1">49</span><span class="pl-kos">,</span>
        <span class="pl-s">"min"</span>: <span class="pl-c1">1251.9348</span><span class="pl-kos">,</span>
        <span class="pl-s">"max"</span>: <span class="pl-c1">1441.2696</span><span class="pl-kos">,</span>
        <span class="pl-s">"avg"</span>: <span class="pl-c1">1308.7523755102038</span><span class="pl-kos">,</span>
        <span class="pl-s">"p75"</span>: <span class="pl-c1">1324.1055</span><span class="pl-kos">,</span>
        <span class="pl-s">"p99"</span>: <span class="pl-c1">1441.2696</span><span class="pl-kos">,</span>
        <span class="pl-s">"p995"</span>: <span class="pl-c1">1441.2696</span><span class="pl-kos">,</span>
        <span class="pl-s">"p999"</span>: <span class="pl-c1">1441.2696</span>
      <span class="pl-kos">}</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span>
      <span class="pl-c">// ..</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">We should think of some other improvements as well, like no "ok" sub object in "result" and not serializing the group name when it's "null" or perhaps grouping together benches with the same group?</p>
<p dir="auto">Related <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1583446788" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/17774" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/17774/hovercard" href="https://github.com/denoland/deno/issues/17774">#17774</a></p>