import { createRequire } from "node:module";
import { pathToFileURL } from "node:url";
import { I as INTERNAL_setAllEnv, s as serverEntry, j as joinPath, __tla as __tla_0 } from "./assets/server-entry-inner-DFzcLk7e.js";
import "node:async_hooks";
import "node:path";
import "http";
import "http2";
import "stream";
import "crypto";
import "fs";
import "path";
import "process";
import "./__vite_rsc_assets_manifest.js";
import "./__waku_build_metadata.js";
let INTERNAL_runBuild;
let __tla = Promise.all([
  (() => {
    try {
      return __tla_0;
    } catch {
    }
  })()
]).then(async () => {
  function resolveModuleId(moduleId, rootDir) {
    if (moduleId.startsWith("file://")) {
      return moduleId;
    }
    if (moduleId.startsWith("/")) {
      return pathToFileURL(joinPath(rootDir, moduleId.slice(1))).href;
    }
    const require2 = createRequire(joinPath(rootDir, "DUMMY.js"));
    const resolved = require2.resolve(moduleId);
    return pathToFileURL(resolved).href;
  }
  INTERNAL_runBuild = async function({ rootDir, emitFile }) {
    INTERNAL_setAllEnv(process.env);
    let build = serverEntry.build;
    for (const enhancer of serverEntry.buildEnhancers || []) {
      const moduleId = resolveModuleId(enhancer, rootDir);
      const mod = await import(moduleId).then(async (m) => {
        await m.__tla;
        return m;
      });
      build = await mod.default(build);
    }
    await build({
      emitFile
    }, serverEntry.buildOptions || {});
  };
});
export {
  INTERNAL_runBuild,
  __tla
};
