Skip to content

Commit

Permalink
Revert "chore: add wrapConsoleTimeAsync"
Browse files Browse the repository at this point in the history
This reverts commit 4417a49.
  • Loading branch information
hi-ogawa committed Nov 28, 2023
1 parent 4417a49 commit 4acfb2f
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,7 @@ const writeFileSafe = async (file: string, contents: string): Promise<void> => {
await fse.writeFile(file, contents);
};

function wrapConsoleTimeAsync<F extends (...args: any[]) => any>(f: F) {
const wrapper = async function (this: any, ...args: any[]) {
const id = Math.random().toString(36).slice(2).padStart(12, "0");
const label = `${f.name}:${id}`;
globalThis.console.time(label);
try {
return await f.apply(this, args);
} finally {
globalThis.console.timeEnd(label);
}
}
return wrapper as F;
}

let getRouteManifestModuleExports = async (
const getRouteManifestModuleExports = async (
viteChildCompiler: Vite.ViteDevServer | null,
pluginConfig: ResolvedRemixVitePluginConfig
): Promise<Record<string, string[]>> => {
Expand All @@ -236,9 +222,7 @@ let getRouteManifestModuleExports = async (
return Object.fromEntries(entries);
};

getRouteManifestModuleExports = wrapConsoleTimeAsync(getRouteManifestModuleExports);

let getRouteModuleExports = async (
const getRouteModuleExports = async (
viteChildCompiler: Vite.ViteDevServer | null,
pluginConfig: ResolvedRemixVitePluginConfig,
routeFile: string
Expand All @@ -263,8 +247,6 @@ let getRouteModuleExports = async (
return exportNames;
};

getRouteModuleExports = wrapConsoleTimeAsync(getRouteModuleExports);

const showUnstableWarning = () => {
console.warn(
colors.yellow(
Expand Down

0 comments on commit 4acfb2f

Please sign in to comment.