Skip to content

Commit

Permalink
refactor(dev): rename onBuildFailure to onCompileFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Oct 27, 2022
1 parent 9d36189 commit 225bdea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/remix-dev/cli/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export async function build(
await compiler.build(config, {
mode,
sourcemap,
onBuildFailure: (failure) => {
onCompileFailure: (failure) => {
compiler.logCompileFailure(failure);
throw Error();
},
Expand Down
6 changes: 3 additions & 3 deletions packages/remix-dev/compiler/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export async function build(
target = "node14",
sourcemap = false,
onWarning = warnOnce,
onBuildFailure = logCompileFailure,
onCompileFailure = logCompileFailure,
}: Partial<CompileOptions> = {}
): Promise<void> {
let compiler = createRemixCompiler(config, {
mode,
target,
sourcemap,
onWarning,
onBuildFailure,
onCompileFailure,
});
await compile(compiler, { onCompileFailure: onBuildFailure });
await compile(compiler, { onCompileFailure });
}
2 changes: 1 addition & 1 deletion packages/remix-dev/compiler/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
10 changes: 5 additions & 5 deletions packages/remix-dev/compiler/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function watch(
target = "node14",
sourcemap = true,
onWarning = warnOnce,
onBuildFailure = logCompileFailure,
onCompileFailure = logCompileFailure,
onRebuildStart,
onRebuildFinish,
onFileCreated,
Expand All @@ -47,7 +47,7 @@ export async function watch(
mode,
target,
sourcemap,
onBuildFailure,
onCompileFailure,
onWarning,
};

Expand All @@ -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;
}

Expand All @@ -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);

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 225bdea

Please sign in to comment.