diff --git a/packages/remix-dev/cli/commands.ts b/packages/remix-dev/cli/commands.ts index 27fc3914b48..b4495eb7bfa 100644 --- a/packages/remix-dev/cli/commands.ts +++ b/packages/remix-dev/cli/commands.ts @@ -12,7 +12,7 @@ import type { createApp as createAppType } from "@remix-run/serve"; import getPort, { makeRange } from "get-port"; import * as esbuild from "esbuild"; -import { parseMode } from "../build"; +import { parseMode } from "../compiler/options"; import * as colors from "../colors"; import * as compiler from "../compiler"; import type { RemixConfig } from "../config"; diff --git a/packages/remix-dev/compiler/build.ts b/packages/remix-dev/compiler/build.ts index 161d9870736..f7996790e28 100644 --- a/packages/remix-dev/compiler/build.ts +++ b/packages/remix-dev/compiler/build.ts @@ -1,7 +1,7 @@ -import { type BuildOptions } from "../build"; import { type RemixConfig } from "../config"; import { warnOnce } from "./warnings"; import { logCompileFailure } from "./on-compile-failure"; +import { type CompileOptions } from "./options"; import { compile, createRemixCompiler } from "./remix-compiler"; export async function build( @@ -12,7 +12,7 @@ export async function build( sourcemap = false, onWarning = warnOnce, onBuildFailure = logCompileFailure, - }: Partial = {} + }: Partial = {} ): Promise { let compiler = createRemixCompiler(config, { mode, diff --git a/packages/remix-dev/compiler/compile-browser.ts b/packages/remix-dev/compiler/compile-browser.ts index 31436a34bfa..338dd8a7dd8 100644 --- a/packages/remix-dev/compiler/compile-browser.ts +++ b/packages/remix-dev/compiler/compile-browser.ts @@ -4,11 +4,11 @@ import * as esbuild from "esbuild"; import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill"; import { pnpPlugin as yarnPnpPlugin } from "@yarnpkg/esbuild-plugin-pnp"; -import { type BuildOptions } from "../build"; import { type RemixConfig } from "../config"; import { createAssetsManifest, type AssetsManifest } from "./assets"; import { getAppDependencies } from "./dependencies"; import { loaders } from "./loaders"; +import { type CompileOptions } from "./options"; import { browserRouteModulesPlugin } from "./plugins/browserRouteModulesPlugin"; import { cssFilePlugin } from "./plugins/cssFilePlugin"; import { emptyModulesPlugin } from "./plugins/emptyModulesPlugin"; @@ -58,7 +58,7 @@ const writeAssetsManifest = async ( const createEsbuildConfig = ( config: RemixConfig, - options: BuildOptions + options: CompileOptions ): esbuild.BuildOptions | esbuild.BuildIncremental => { let entryPoints: esbuild.BuildOptions["entryPoints"] = { "entry.client": path.resolve(config.appDirectory, config.entryClientFile), @@ -116,7 +116,7 @@ const createEsbuildConfig = ( export const createBrowserCompiler = ( remixConfig: RemixConfig, - options: BuildOptions + options: CompileOptions ): BrowserCompiler => { let compiler: esbuild.BuildIncremental; let esbuildConfig = createEsbuildConfig(remixConfig, options); diff --git a/packages/remix-dev/compiler/compile-server.ts b/packages/remix-dev/compiler/compile-server.ts index d0793d872ab..662dd9fde2f 100644 --- a/packages/remix-dev/compiler/compile-server.ts +++ b/packages/remix-dev/compiler/compile-server.ts @@ -4,10 +4,10 @@ import * as fse from "fs-extra"; import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill"; import { pnpPlugin as yarnPnpPlugin } from "@yarnpkg/esbuild-plugin-pnp"; -import { type BuildOptions } from "../build"; import { type RemixConfig } from "../config"; import { type AssetsManifest } from "./assets"; import { loaders } from "./loaders"; +import { type CompileOptions } from "./options"; import { cssFilePlugin } from "./plugins/cssFilePlugin"; import { emptyModulesPlugin } from "./plugins/emptyModulesPlugin"; import { mdxPlugin } from "./plugins/mdx"; @@ -27,7 +27,7 @@ export type ServerCompiler = { const createEsbuildConfig = ( config: RemixConfig, assetsManifestChannel: ReadChannel, - options: BuildOptions + options: CompileOptions ): esbuild.BuildOptions => { let stdin: esbuild.StdinOptions | undefined; let entryPoints: string[] | undefined; @@ -148,7 +148,7 @@ async function writeServerBuildResult( export const createServerCompiler = ( remixConfig: RemixConfig, - options: BuildOptions + options: CompileOptions ): ServerCompiler => { let compile = async (manifestChannel: ReadChannel) => { console.log("started server build"); diff --git a/packages/remix-dev/build.ts b/packages/remix-dev/compiler/options.ts similarity index 95% rename from packages/remix-dev/build.ts rename to packages/remix-dev/compiler/options.ts index f95125f96b1..fe64010a8f3 100644 --- a/packages/remix-dev/build.ts +++ b/packages/remix-dev/compiler/options.ts @@ -20,7 +20,7 @@ type Target = | "cloudflare-workers" | "node14"; -export type BuildOptions = { +export type CompileOptions = { mode: Mode; target: Target; sourcemap: boolean; diff --git a/packages/remix-dev/compiler/plugins/cssFilePlugin.ts b/packages/remix-dev/compiler/plugins/cssFilePlugin.ts index ceb34d2a483..9bee1a89ded 100644 --- a/packages/remix-dev/compiler/plugins/cssFilePlugin.ts +++ b/packages/remix-dev/compiler/plugins/cssFilePlugin.ts @@ -2,8 +2,8 @@ import * as path from "path"; import * as fse from "fs-extra"; import esbuild from "esbuild"; -import type { BuildOptions } from "../../build"; import invariant from "../../invariant"; +import { type CompileOptions } from "../options"; const isExtendedLengthPath = /^\\\\\?\\/; @@ -16,7 +16,7 @@ function normalizePathSlashes(p: string) { * and exports the url of the css file as its default export. */ export function cssFilePlugin(options: { - mode: BuildOptions["mode"]; + mode: CompileOptions["mode"]; }): esbuild.Plugin { return { name: "css-file", diff --git a/packages/remix-dev/compiler/remix-compiler.ts b/packages/remix-dev/compiler/remix-compiler.ts index c76c4bdaf09..4d51394a6d7 100644 --- a/packages/remix-dev/compiler/remix-compiler.ts +++ b/packages/remix-dev/compiler/remix-compiler.ts @@ -1,9 +1,9 @@ -import { type BuildOptions } from "../build"; import { type RemixConfig } from "../config"; import { type AssetsManifest } from "./assets"; import { type BrowserCompiler, createBrowserCompiler } from "./compile-browser"; import { type ServerCompiler, createServerCompiler } from "./compile-server"; import { type OnCompileFailure } from "./on-compile-failure"; +import { type CompileOptions } from "./options"; import { createChannel } from "./utils/channel"; type RemixCompiler = { @@ -13,7 +13,7 @@ type RemixCompiler = { export const createRemixCompiler = ( remixConfig: RemixConfig, - options: BuildOptions + options: CompileOptions ): RemixCompiler => { return { browser: createBrowserCompiler(remixConfig, options),