import { render } from "./renderDocument";
import packagejson from "next/package.json";

const version = packagejson.version;

if (!version.startsWith("12.2")) {
  console.warn(
    "Possibly incompatible Next.js version: ",
    version,
    ". Please upgrade to Next.js 12.2.0+.\n",
  );
}

let buildId = 0;

let DocumentLoaded = false;
let DocumentNamespace;

import(Bun.routesDir + "_document").then(
  (doc) => {
    DocumentNamespace = doc;
    DocumentLoaded = true;
  },
  (err) => {
    // ResolveError is defined outside of bun-framework-next in ../../src/runtime/errors
    // @ts-expect-error
    if (err instanceof ResolveError) {
      DocumentLoaded = true;
    } else {
      console.error(err);
    }
  },
);

addEventListener("fetch", async (event: FetchEvent) => {
  const route = Bun.match(event);

  // This imports the currently matched route.
  let PageNamespace: any;

  try {
    PageNamespace = await import(route.filePath);
  } catch (exception) {
    console.error("Error loading page:", route.filePath);
    throw exception;
  }

  // This returns all .css files that were imported in the line above.
  // It's recursive, so any file that imports a CSS file will be included.
  const pageStylesheets = (Bun.getImportedStyles() as string[]).slice();

  let appRoute: any;

  try {
    appRoute = await import(Bun.routesDir + "_app");
  } catch (exception) {
    // ResolveError is defined outside of bun-framework-next in ../../src/runtime/errors
    // @ts-expect-error
    if (exception && !(exception instanceof ResolveError)) {
      console.error("Error loading app:", Bun.routesDir + "_app");
      throw exception;
    }
  }

  const appStylesheets = (Bun.getImportedStyles() as string[]).slice();
  let response: Response;
  try {
    response = await render({
      route,
      PageNamespace,
      appStylesheets,
      pageStylesheets,
      DocumentNamespace,
      AppNamespace: appRoute,
      buildId,
      routePaths: Bun.getRouteFiles(),
      routeNames: Bun.getRouteNames(),
      request: event.request,
    });
  } catch (exception) {
    console.error("Error rendering route", route.filePath);
    throw exception;
  }

  event.respondWith(response);

  buildId++;
});

declare let Bun: any;
export {};
</option>
<option value='dave/es5-class-helper'>dave/es5-class-helper</option>
<option value='dave/import.meta.resolve'>dave/import.meta.resolve</option>
<option value='dave/install-tag-without-dash'>dave/install-tag-without-dash</option>
<option value='dave/lol'>dave/lol</option>
<option value='dave/nodemodule-preloadmodules'>dave/nodemodule-preloadmodules</option>
<option value='dave/postinstall'>dave/postinstall</option>
<option value='dave/postinstall_2'>dave/postinstall_2</option>
<option value='dave/remove-native-event'>dave/remove-native-event</option>
<option value='dave/zlib'>dave/zlib</option>
<option value='debugger-dev'>debugger-dev</option>
<option value='derrick/fix/bindings-mark-jscinitialize'>derrick/fix/bindings-mark-jscinitialize</option>
<option value='derrick/fix/event-emitter-async-iter'>derrick/fix/event-emitter-async-iter</option>
<option value='derrick/fix/event-emitter-emit-throw-native'>derrick/fix/event-emitter-emit-throw-native</option>
<option value='derrick/fix/http-lowercase-headers'>derrick/fix/http-lowercase-headers</option>
<option value='derrick/fix/node-tests'>derrick/fix/node-tests</option>
<option value='derrick/test/add-ed25519-tests'>derrick/test/add-ed25519-tests</option>
<option value='detect-libc'>detect-libc</option>
<option value='doc/0.8'>doc/0.8</option>
<option value='dylan/callback-fulfilled-after-rejection'>dylan/callback-fulfilled-after-rejection</option>
<option value='dylan/change-pathname-assert'>dylan/change-pathname-assert</option>
<option value='dylan/cli-fixes'>dylan/cli-fixes</option>
<option value='dylan/encoding-fix'>dylan/encoding-fix</option>
<option value='dylan/fix-bundling-lodash-es-is-buffer'>dylan/fix-bundling-lodash-es-is-buffer</option>
<option value='dylan/fix-error-inlining'>dylan/fix-error-inlining</option>
<option value='dylan/fix-module-field-in-exports'>dylan/fix-module-field-in-exports</option>
<option value='dylan/github-api-option'>dylan/github-api-option</option>
<option value='dylan/github-dependencies'>dylan/github-dependencies</option>
<option value='dylan/import-file-path'>dylan/import-file-path</option>
<option value='dylan/non-enumerable-export-values'>dylan/non-enumerable-export-values</option>
<option value='dylan/resolve-rope-in-string'>dylan/resolve-rope-in-string</option>
<option value='dylan/set-exit-code'>dylan/set-exit-code</option>
<option value='dylan/source-map-names-property'>dylan/source-map-names-property</option>
<option value='eventstream'>eventstream</option>
<option value='feat/ecosystem'>feat/ecosystem</option>
<option value='feat/npm'>feat/npm</option>
<option value='fix'>fix</option>
<option value='fix-prepare-stack-trace'>fix-prepare-stack-trace</option>
<option value='fix-websocket-upgrade'>fix-websocket-upgrade</option>
<option value='fs-watch-file'>fs-watch-file</option>
<option value='got'>got</option>
<option value='guides-3'>guides-3</option>
<option value='improve-docker'>improve-docker</option>
<option value='insensitive-pkg-names'>insensitive-pkg-names</option>
<option value='integration-tests'>integration-tests</option>
<option value='jarred/5859'>jarred/5859</option>
<option value='jarred/actions'>jarred/actions</option>
<option value='jarred/add-git'>jarred/add-git</option>
<option value='jarred/analytics'>jarred/analytics</option>
<option value='jarred/arenas'>jarred/arenas</option>
<option value='jarred/ast'>jarred/ast</option>
<option value='jarred/ast-again'>jarred/ast-again</option>
<option value='jarred/async_bio'>jarred/async_bio</option>
<option value='jarred/bench'>jarred/bench</option>
<option value='jarred/brotli'>jarred/brotli</option>
<option value='jarred/bump-uws'>jarred/bump-uws</option>
<option value='jarred/bundle-workspace-packages'>jarred/bundle-workspace-packages</option>
<option value='jarred/bunfig'>jarred/bunfig</option>
<option value='jarred/callable'>jarred/callable</option>
<option value='jarred/canvas'>jarred/canvas</option>
<option value='jarred/ci-check'>jarred/ci-check</option>
<option value='jarred/cjs2'>jarred/cjs2</option>
<option value='jarred/cleanup-error'>jarred/cleanup-error</option>
<option value='jarred/clipboard-objc'>jarred/clipboard-objc</option>
<option value='jarred/direct'>jarred/direct</option>
<option value='jarred/dump'>jarred/dump</option>
<option value='jarred/edgecase'>jarred/edgecase</option>
<option value='jarred/esbuild-plugin-api'>jarred/esbuild-plugin-api</option>
<option value='jarred/escapeHTML'>jarred/escapeHTML</option>
<option value='jarred/esm-conditions'>jarred/esm-conditions</option>
<option value='jarred/experiment-bsp'>jarred/experiment-bsp</option>
<option value='jarred/export-star-flat'>jarred/export-star-flat</option>
<option value='jarred/exports-map'>jarred/exports-map</option>
<option value='jarred/faster-error-capturestacktrace'>jarred/faster-error-capturestacktrace</option>
<option value='jarred/faster-ordered-properties'>jarred/faster-ordered-properties</option>
<option value='jarred/fastmalloc'>jarred/fastmalloc</option>
<option value='jarred/fetch-experiment'>jarred/fetch-experiment</option>
<option value='jarred/fetchheaders'>jarred/fetchheaders</option>
<option value='jarred/fix-blob-slice-test'>jarred/fix-blob-slice-test</option>
<option value='jarred/fix-bunbun-on-wsl'>jarred/fix-bunbun-on-wsl</option>
<option value='jarred/fix-crash'>jarred/fix-crash</option>
<option value='jarred/fix-http-compression'>jarred/fix-http-compression</option>
<option value='jarred/fix-issue-with-tsconfig-run'>jarred/fix-issue-with-tsconfig-run</option>
<option value='jarred/fix-proxy-regression'>jarred/fix-proxy-regression</option>
<option value='jarred/fixes-3129'>jarred/fixes-3129</option>
<option value='jarred/gen'>jarred/gen</option>
<option value='jarred/htmlrewriter'>jarred/htmlrewriter</option>
<option value='jarred/improve-testing'>jarred/improve-testing</option>
<option value='jarred/inquirer'>jarred/inquirer</option>
<option value='jarred/isolation'>jarred/isolation</option>
<option value='jarred/jsc'>jarred/jsc</option>
<option value='jarred/land'>jarred/land</option>
<option value='jarred/landing'>jarred/landing</option>
<option value='jarred/linux'>jarred/linux</option>
<option value='jarred/live-bindings'>jarred/live-bindings</option>
<option value='jarred/make-strings-better'>jarred/make-strings-better</option>
<option value='jarred/mdx-thrwawy'>jarred/mdx-thrwawy</option>
<option value='jarred/move'>jarred/move</option>
<option value='jarred/napi'>jarred/napi</option>
<option value='jarred/new-bund'>jarred/new-bund</option>
<option value='jarred/new-bund-ressurected-branch'>jarred/new-bund-ressurected-branch</option>
<option value='jarred/new-http'>jarred/new-http</option>
<option value='jarred/no-more-npm'>jarred/no-more-npm</option>
<option value='jarred/package-mapper'>jarred/package-mapper</option>
<option value='jarred/pg'>jarred/pg</option>
<option value='jarred/port'>jarred/port</option>
<option value='jarred/possibly-2732'>jarred/possibly-2732</option>
<option value='jarred/postgresql'>jarred/postgresql</option>
<option value='jarred/precompile-linux-dependencies'>jarred/precompile-linux-dependencies</option>
<option value='jarred/prepare-for-libuv'>jarred/prepare-for-libuv</option>
<option value='jarred/profiled-call'>jarred/profiled-call</option>
<option value='jarred/read-tsconfig-jsx'>jarred/read-tsconfig-jsx</option>
<option value='jarred/redo-evaluation-order'>jarred/redo-evaluation-order</option>
<option value='jarred/redo-zigstring-for-utf16'>jarred/redo-zigstring-for-utf16</option>
<option value='jarred/relay'>jarred/relay</option>
<option value='jarred/rename'>jarred/rename</option>
<option value='jarred/repl'>jarred/repl</option>
<option value='jarred/request-finalizer'>jarred/request-finalizer</option>
<option value='jarred/rewrite-router'>jarred/rewrite-router</option>
<option value='jarred/run'>jarred/run</option>
<option value='jarred/simdjson'>jarred/simdjson</option>
<option value='jarred/simplify'>jarred/simplify</option>
<option value='jarred/some-fixes-for-eventsource'>jarred/some-fixes-for-eventsource</option>
<option value='jarred/standalone-repro1'>jarred/standalone-repro1</option>
<option value='jarred/start'>jarred/start</option>
<option value='jarred/strong'>jarred/strong</option>
<option value='jarred/subprocess'>jarred/subprocess</option>
<option value='jarred/support-tee'>jarred/support-tee</option>
<option value='jarred/tcc'>jarred/tcc</option>
<option value='jarred/throw-if'>jarred/throw-if</option>
<option value='jarred/update-install-stuff'>jarred/update-install-stuff</option>
<option value='jarred/update-zig1'>jarred/update-zig1</option>
<option value='jarred/upgrade-zig-2'>jarred/upgrade-zig-2</option>
<option value='jarred/uws'>jarred/uws</option>
<option value='jarred/webkit-upgrade-may-17'>jarred/webkit-upgrade-may-17</option>
<option value='jarred/wip-more-reliable'>jarred/wip-more-reliable</option>
<option value='jarred/workers'>jarred/workers</option>
<option value='jarred/zlib'>jarred/zlib</option>
<option value='jarred/zls'>jarred/zls</option>
<option value='lithdew/picohttp-mimalloc'>lithdew/picohttp-mimalloc</option>
<option value='main'>main</option>
<option value='move-templates'>move-templates</option>
<option value='nestjs-guide'>nestjs-guide</option>
<option value='next-cleanup'>next-cleanup</option>
<option value='origin/main'>origin/main</option>
<option value='plugin/plugindata'>plugin/plugindata</option>
<option value='plugin/resolvedir'>plugin/resolvedir</option>
<option value='postinstall_3'>postinstall_3</option>
<option value='repl'>repl</option>
<option value='request-body-stream'>request-body-stream</option>
<option value='reserve-commands'>reserve-commands</option>
<option value='revert-5167-dylan/decode-regex-if-needed'>revert-5167-dylan/decode-regex-if-needed</option>
<option value='rfc/bun-bundler-api'>rfc/bun-bundler-api</option>
<option value='rfc/bunfig-overhaul'>rfc/bunfig-overhaul</option>
<option value='save-in-update'>save-in-update</option>
<option value='sdl'>sdl</option>
<option value='test/action'>test/action</option>
<option value='types/mock'>types/mock</option>
<option value='types/readable-stream-default'>types/readable-stream-default</option>
<option value='types/tty'>types/tty</option>
<option value='u/vjpr/zig-0.10'>u/vjpr/zig-0.10</option>
<option value='xHyroM/types/expose-Bun-Env'>xHyroM/types/expose-Bun-Env</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Unnamed repository; edit this file 'description' to name the repository.</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/ansg191/bun/about/?h=cli-flags'>about</a><a href='/ansg191/bun/?h=cli-flags'>summary</a><a href='/ansg191/bun/refs/?h=cli-flags'>refs</a><a class='active' href='/ansg191/bun/log/test/js/web/streams?h=cli-flags&amp;showmsg=1&amp;follow=1'>log</a><a href='/ansg191/bun/tree/test/js/web/streams?h=cli-flags'>tree</a><a href='/ansg191/bun/commit/test/js/web/streams?h=cli-flags&amp;follow=1'>commit</a><a href='/ansg191/bun/diff/test/js/web/streams?h=cli-flags&amp;follow=1'>diff</a></td><td class='form'><form class='right' method='get' action='/ansg191/bun/log/test/js/web/streams'>
<input type='hidden' name='h' value='cli-flags'/><input type='hidden' name='showmsg' value='1'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/ansg191/bun/log/?h=cli-flags&amp;showmsg=1&amp;follow=1'>root</a>/<a href='/ansg191/bun/log/test?h=cli-flags&amp;showmsg=1&amp;follow=1'>test</a>/<a href='/ansg191/bun/log/test/js?h=cli-flags&amp;showmsg=1&amp;follow=1'>js</a>/<a href='/ansg191/bun/log/test/js/web?h=cli-flags&amp;showmsg=1&amp;follow=1'>web</a>/<a href='/ansg191/bun/log/test/js/web/streams?h=cli-flags&amp;showmsg=1&amp;follow=1'>streams</a> (<a href='/ansg191/bun/log/test/js/web/streams?h=cli-flags&amp;showmsg=1'>unfollow</a>)</div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/ansg191/bun/log/test/js/web/streams?h=cli-flags&amp;follow=1'>Collapse</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr class='logheader'><td><span title='2023-10-12 16:33:37 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=cli-flags&amp;id=c9e1c6455fadd55a07eabcd9128541a1d349fff7&amp;follow=1'>Tweaks</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:05:03 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/cli.zig?h=cli-flags&amp;id=c12140f2aab40b8c8e548312c030f00adcde3ec1&amp;follow=1'>Fix struct</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:04:57 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=cli-flags&amp;id=71a40672c2b73b39b4a54197f939ba1428902639&amp;follow=1'>Clean up, implement warn_on_unrecognized_flag</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>4</td><td><span class='deletions'>-26</span>/<span class='insertions'>+40</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:04:25 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/deps/zig-clap/clap/streaming.zig?h=cli-flags&amp;id=6180b2dc2afec4a8c8ad9e8462301b8c8d089199&amp;follow=1'>WIP</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>4</td><td><span class='deletions'>-77</span>/<span class='insertions'>+14</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:04:02 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=cli-flags&amp;id=07db922aad3b043a0b1826019e356b9e09c8d27b&amp;follow=1'>WIP</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>5</td><td><span class='deletions'>-347</span>/<span class='insertions'>+353</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:03:28 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/install/install.zig?h=cli-flags&amp;id=bd2c8ca3d3d4c9ab6b89917395b13989bb08b051&amp;follow=1'>WIP</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>5</td><td><span class='deletions'>-209</span>/<span class='insertions'>+446</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:02:34 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/deps/zig-clap/clap.zig?h=cli-flags&amp;id=c12ae0c46451eddb23c44d3335e79b56f6307ed9&amp;follow=1'>WIP</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>2</td><td><span class='deletions'>-24</span>/<span class='insertions'>+106</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:02:34 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/cli.zig?h=cli-flags&amp;id=acb3b56bec314dea1aa1e1bdb60d27315c178b93&amp;follow=1'>Improve helptext</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-55</span>/<span class='insertions'>+83</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:02:34 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/deps/zig-clap/clap/streaming.zig?h=cli-flags&amp;id=2b661aa52bcc0a85c1d5a84d7cb0bd934ee420cf&amp;follow=1'>WIP</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>3</td><td><span class='deletions'>-49</span>/<span class='insertions'>+147</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 16:02:34 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/deps/zig-clap/clap.zig?h=cli-flags&amp;id=3cd555210cae15d39e5b615a79f1ecad9de71861&amp;follow=1'>WIP</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>2</td><td><span class='deletions'>-0</span>/<span class='insertions'>+19</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 15:17:03 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/cli/install/loader-runner-4.3.0.tgz?h=cli-flags&amp;id=892593c73b93bd5c0d4a9211c08646729f22f034&amp;follow=1'>fix install test</a></td><td><img src='//www.gravatar.com/avatar/0f2ac0141773b63a6cd646063e7ebfca?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Dylan Conway
</td><td>2</td><td><span class='deletions'>-6</span>/<span class='insertions'>+8</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 15:02:05 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/js/bun/test/jest-extended.test.js?h=cli-flags&amp;id=691cf338c2a88fd2629f50934fe35fcb5bd08ae2&amp;follow=1'>fix editing package json when adding github dependency (#6432)</a></td><td><img src='//www.gravatar.com/avatar/9c0e69537b9d9493708725dd4c91e3af?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Dylan Conway
</td><td>5</td><td><span class='deletions'>-14</span>/<span class='insertions'>+146</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* fix package name added to package json

* check for github tag

* remove alloc

* some tests

* fix test

</td></tr>
<tr class='logheader'><td><span title='2023-10-12 14:12:53 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/installation.md?h=cli-flags&amp;id=beb746e5eaf7681212e9f6d72c782abe7789471d&amp;follow=1'>Update installation.md</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-8</span>/<span class='insertions'>+14</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 13:43:45 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/installation.md?h=cli-flags&amp;id=89faee2522c463f7d59bc4ef9f6146a83a9e5a8b&amp;follow=1'>Update installation.md</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-3</span>/<span class='insertions'>+3</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 02:03:02 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/cli/install/overrides.test.ts?h=cli-flags&amp;id=969da088f5db3258a803ec186012e30f992829b4&amp;follow=1'>fix(install): re-evaluate overrides when removed</a><span class='decoration'><a class='tag-deco' href='/ansg191/bun/tag/?h=bun-v1.0.6'>bun-v1.0.6</a></span></td><td><img src='//www.gravatar.com/avatar/7eeb3c9446e467f71ba578a6fcc9c614?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> dave caruso
</td><td>3</td><td><span class='deletions'>-3</span>/<span class='insertions'>+45</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 01:00:27 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/bundler/index.md?h=cli-flags&amp;id=c50be68790782e82c268e80e1c5a31c5d8caf093&amp;follow=1'>chore: add missing ending quote (#6436)</a></td><td><img src='//www.gravatar.com/avatar/7390814850c81bbb7be3542d6c73b500?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Luna
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-12 00:44:15 -0700'>2023-10-12</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/cli/install/overrides.test.ts?h=cli-flags&amp;id=2fbb95142a8ad6ce182e034ca11e70fdf2b95c34&amp;follow=1'>feat(install): support npm overrides/yarn resolutions, one level deep only ↵</a></td><td><img src='//www.gravatar.com/avatar/7eeb3c9446e467f71ba578a6fcc9c614?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> dave caruso
</td><td>7</td><td><span class='deletions'>-31</span>/<span class='insertions'>+640</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
(#6435)

* disable zig fmt on generated ResolvedSourceTag.zig

* overrides

* it works

* ok

* a

---------

Co-authored-by: Jarred Sumner &lt;jarred@jarredsumner.com&gt;

</td></tr>
<tr class='logheader'><td><span title='2023-10-11 20:41:12 -0700'>2023-10-11</span></td><td class='logsubject'><a href='/ansg191/bun/commit/test/cli/install/bun-install.test.ts?h=cli-flags&amp;id=755e16d962667621039a73e9d336b7ae16dcc00f&amp;follow=1'>fix #6416 (#6430)</a></td><td><img src='//www.gravatar.com/avatar/9c0e69537b9d9493708725dd4c91e3af?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Dylan Conway
</td><td>2</td><td><span class='deletions'>-1</span>/<span class='insertions'>+132</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
* make sure latest is checked after prerelease

* test and fix

* test for when latest matches prerelease

</td></tr>
<tr class='logheader'><td><span title='2023-10-11 20:04:15 -0700'>2023-10-11</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/WebKit?h=cli-flags&amp;id=b1063edf3e76a2ef68d2ba3eff686932f742c77c&amp;follow=1'>Bump WebKit</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>9</td><td><span class='deletions'>-29</span>/<span class='insertions'>+29</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-11 19:05:52 -0700'>2023-10-11</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/build-id?h=cli-flags&amp;id=edb4cbac2b03c4350c6efcfbfc50bda5159800be&amp;follow=1'>Bump!</a></td><td><img src='//www.gravatar.com/avatar/5145ad1d8bb861137d85da7a3e32ef36?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Jarred Sumner
</td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-11 15:26:55 -0700'>2023-10-11</span></td><td class='logsubject'><a href='/ansg191/bun/commit/src/bun.js/bindings/JSCUSocketsLoopIntegration.cpp?h=cli-flags&amp;id=a59a69e21baefc0bb3c671ec9a688b02ad126790&amp;follow=1'>Update JSCUSocketsLoopIntegration.cpp</a></td><td><img src='//www.gravatar.com/avatar/0f2ac0141773b63a6cd646063e7ebfca?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Dylan Conway
</td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td><span title='2023-10-11 14:31:39 -0700'>2023-10-11</span></td><td class='logsubject'><a href='/ansg191/bun/commit/docs/installation.md?h=cli-flags&amp;id=4c9e0099719895eaf95e3149256bf8d1338d2378&amp;follow=1'>Update installation.md</a></td><td><img src='//www.gravatar.com/avatar/7314f20052c467b4e5b959ac03e39ff0?s=13&amp;d=retro' width='13' height='13' alt='Gravatar' /> Colin McDonnell
</td><td>1</td><td><span class='deletions'>-10</span>/<span class='insertions'>+7</span></td></tr>
<tr class='nohover-highlight'><td/><td colspan='5' class='logmsg'>
</td></tr>
