From 225bdea02c2cf556078ae3835926cae30b53c5a2 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Thu, 27 Oct 2022 12:24:16 -0400 Subject: [PATCH] refactor(dev): rename `onBuildFailure` to `onCompileFailure` --- packages/remix-dev/cli/commands.ts | 2 +- packages/remix-dev/compiler/build.ts | 6 +++--- packages/remix-dev/compiler/options.ts | 2 +- packages/remix-dev/compiler/watch.ts | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/remix-dev/cli/commands.ts b/packages/remix-dev/cli/commands.ts index e3718b1a57b..8cc345f7e04 100644 --- a/packages/remix-dev/cli/commands.ts +++ b/packages/remix-dev/cli/commands.ts @@ -172,7 +172,7 @@ export async function build( await compiler.build(config, { mode, sourcemap, - onBuildFailure: (failure) => { + onCompileFailure: (failure) => { compiler.logCompileFailure(failure); throw Error(); }, diff --git a/packages/remix-dev/compiler/build.ts b/packages/remix-dev/compiler/build.ts index 3ab9b326580..265709181f7 100644 --- a/packages/remix-dev/compiler/build.ts +++ b/packages/remix-dev/compiler/build.ts @@ -11,7 +11,7 @@ export async function build( target = "node14", sourcemap = false, onWarning = warnOnce, - onBuildFailure = logCompileFailure, + onCompileFailure = logCompileFailure, }: Partial = {} ): Promise { let compiler = createRemixCompiler(config, { @@ -19,7 +19,7 @@ export async function build( target, sourcemap, onWarning, - onBuildFailure, + onCompileFailure, }); - await compile(compiler, { onCompileFailure: onBuildFailure }); + await compile(compiler, { onCompileFailure }); } diff --git a/packages/remix-dev/compiler/options.ts b/packages/remix-dev/compiler/options.ts index 7c16895a3d1..59f6853647a 100644 --- a/packages/remix-dev/compiler/options.ts +++ b/packages/remix-dev/compiler/options.ts @@ -25,5 +25,5 @@ export type CompileOptions = { target: Target; sourcemap: boolean; onWarning?: (message: string, key: string) => void; - onBuildFailure?: (failure: Error | esbuild.BuildFailure) => void; + onCompileFailure?: (failure: Error | esbuild.BuildFailure) => void; }; diff --git a/packages/remix-dev/compiler/watch.ts b/packages/remix-dev/compiler/watch.ts index f354a921a84..a20fa52f6a3 100644 --- a/packages/remix-dev/compiler/watch.ts +++ b/packages/remix-dev/compiler/watch.ts @@ -34,7 +34,7 @@ export async function watch( target = "node14", sourcemap = true, onWarning = warnOnce, - onBuildFailure = logCompileFailure, + onCompileFailure = logCompileFailure, onRebuildStart, onRebuildFinish, onFileCreated, @@ -47,7 +47,7 @@ export async function watch( mode, target, sourcemap, - onBuildFailure, + onCompileFailure, onWarning, }; @@ -65,7 +65,7 @@ export async function watch( try { config = await readConfig(config.rootDirectory); } catch (error) { - onBuildFailure(error as Error); + onCompileFailure(error as Error); return; } @@ -77,7 +77,7 @@ export async function watch( let rebuild = debounce(async () => { onRebuildStart?.(); let start = Date.now(); - await compile(compiler, { onCompileFailure: onBuildFailure }); + await compile(compiler, { onCompileFailure }); onRebuildFinish?.(Date.now() - start); }, 100); @@ -110,7 +110,7 @@ export async function watch( try { config = await readConfig(config.rootDirectory); } catch (error) { - onBuildFailure(error as Error); + onCompileFailure(error as Error); return; }