Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

refactor: prepare remix types (#3075)

Bogdan Chadkin33d3dbc546a1
diff --git a/apps/builder/app/routes/$.tsx b/apps/builder/app/routes/$.tsx
index 3f22528908..231df25a7d 100644
--- a/apps/builder/app/routes/$.tsx
+++ b/apps/builder/app/routes/$.tsx
@@ -1,7 +1,7 @@
-import { Links, Meta } from "@remix-run/react";
-import { redirect } from "@remix-run/node";
-import type { LoaderArgs } from "@remix-run/node";
+import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
import {
+ Links,
+ Meta,
isRouteErrorResponse,
useLoaderData,
useRouteError,
@@ -14,7 +14,7 @@ import { Canvas } from "~/canvas";
import { ErrorMessage } from "~/shared/error";
import { dashboardPath, isCanvas } from "~/shared/router-utils";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
const url = new URL(request.url);
// See remix.config.ts for the publicPath value
const publicPath = "/build/";
diff --git a/apps/builder/app/routes/_index.tsx b/apps/builder/app/routes/_index.tsx
index 490e0e144c..58ff518303 100644
--- a/apps/builder/app/routes/_index.tsx
+++ b/apps/builder/app/routes/_index.tsx
@@ -3,7 +3,7 @@
// see https://github.com/remix-run/remix/issues/2098#issuecomment-1049262218 .
// To solve this, we're re-exporting the $.tsx route API in index.tsx
-import type { LoaderArgs } from "@remix-run/node";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import CatchAllContnet, {
loader as catchAllloader,
ErrorBoundary as CatchAllErrorBoundary,
@@ -12,7 +12,7 @@ import CatchAllContnet, {
// We're wrapping functions in order for them to be distinct from the ones in $.tsx.
// If they are the same, Remix may get confused, and don't load data on page transitions.
-export const loader = (args: LoaderArgs) => catchAllloader(args);
+export const loader = (args: LoaderFunctionArgs) => catchAllloader(args);
export const ErrorBoundary = () => <CatchAllErrorBoundary />;
const Content = () => <CatchAllContnet />;
export default Content;
diff --git a/apps/builder/app/routes/auth.dev.tsx b/apps/builder/app/routes/auth.dev.tsx
index 7285a8016f..0affd6106d 100644
--- a/apps/builder/app/routes/auth.dev.tsx
+++ b/apps/builder/app/routes/auth.dev.tsx
@@ -1,4 +1,4 @@
-import { type ActionArgs, redirect } from "@remix-run/node";
+import { type ActionFunctionArgs, redirect } from "@remix-run/server-runtime";
import { authenticator } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import { AUTH_PROVIDERS } from "~/shared/session";
@@ -8,7 +8,7 @@ export default function Dev() {
return null;
}
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
const returnTo = await returnToPath(request);
try {
diff --git a/apps/builder/app/routes/auth.github.callback.tsx b/apps/builder/app/routes/auth.github.callback.tsx
index cf36e23be3..2811cf1887 100644
--- a/apps/builder/app/routes/auth.github.callback.tsx
+++ b/apps/builder/app/routes/auth.github.callback.tsx
@@ -1,10 +1,10 @@
-import { type LoaderArgs, redirect } from "@remix-run/node";
+import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
import { authenticator } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import { AUTH_PROVIDERS } from "~/shared/session";
import { returnToPath } from "~/services/cookie.server";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
const returnTo = await returnToPath(request);
const url = new URL(request.url);
const error = url.searchParams.get("error");
diff --git a/apps/builder/app/routes/auth.github.tsx b/apps/builder/app/routes/auth.github.tsx
index f8148e8ac5..19ac964045 100644
--- a/apps/builder/app/routes/auth.github.tsx
+++ b/apps/builder/app/routes/auth.github.tsx
@@ -1,4 +1,4 @@
-import { type ActionArgs, redirect } from "@remix-run/node";
+import { type ActionFunctionArgs, redirect } from "@remix-run/server-runtime";
import { authenticator } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import { sentryException } from "~/shared/sentry";
@@ -9,7 +9,7 @@ export default function GH() {
return null;
}
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
const returnTo = await returnToPath(request);
try {
diff --git a/apps/builder/app/routes/auth.google.callback.tsx b/apps/builder/app/routes/auth.google.callback.tsx
index 1069dc0a89..5a37c88a0a 100644
--- a/apps/builder/app/routes/auth.google.callback.tsx
+++ b/apps/builder/app/routes/auth.google.callback.tsx
@@ -1,9 +1,9 @@
-import type { LoaderArgs } from "@remix-run/node";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import { authenticator } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import { returnToPath } from "~/services/cookie.server";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
const returnTo = await returnToPath(request);
return authenticator.authenticate("google", request, {
diff --git a/apps/builder/app/routes/auth.google.tsx b/apps/builder/app/routes/auth.google.tsx
index 6319a331c7..457431b0dd 100644
--- a/apps/builder/app/routes/auth.google.tsx
+++ b/apps/builder/app/routes/auth.google.tsx
@@ -1,4 +1,8 @@
-import { type ActionArgs, type LoaderArgs, redirect } from "@remix-run/node";
+import {
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ redirect,
+} from "@remix-run/server-runtime";
import { authenticator } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import { sentryException } from "~/shared/sentry";
@@ -9,9 +13,9 @@ export default function Google() {
return null;
}
-export const loader = (_args: LoaderArgs) => redirect("/login");
+export const loader = (_args: LoaderFunctionArgs) => redirect("/login");
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
const returnTo = await returnToPath(request);
try {
diff --git a/apps/builder/app/routes/builder.$projectId.tsx b/apps/builder/app/routes/builder.$projectId.tsx
index 4a3c966a52..efab656588 100644
--- a/apps/builder/app/routes/builder.$projectId.tsx
+++ b/apps/builder/app/routes/builder.$projectId.tsx
@@ -4,7 +4,11 @@ import {
isRouteErrorResponse,
} from "@remix-run/react";
import type { ShouldRevalidateFunction } from "@remix-run/react";
-import { redirect, type LoaderArgs, json } from "@remix-run/node";
+import {
+ type LoaderFunctionArgs,
+ redirect,
+ json,
+} from "@remix-run/server-runtime";
import { loadBuildByProjectId } from "@webstudio-is/project-build/index.server";
import { db as domainDb } from "@webstudio-is/domain/index.server";
import { db } from "@webstudio-is/project/index.server";
@@ -26,7 +30,7 @@ export { links };
export const loader = async ({
params,
request,
-}: LoaderArgs): Promise<BuilderProps> => {
+}: LoaderFunctionArgs): Promise<BuilderProps> => {
const context = await createContext(request);
try {
diff --git a/apps/builder/app/routes/builder.tsx b/apps/builder/app/routes/builder.tsx
index 576e1a969e..9556a7ca3b 100644
--- a/apps/builder/app/routes/builder.tsx
+++ b/apps/builder/app/routes/builder.tsx
@@ -1,13 +1,13 @@
import type {
- LoaderArgs,
- V2_MetaFunction as MetaFunction,
-} from "@remix-run/node";
+ LoaderFunctionArgs,
+ V2_ServerRuntimeMetaFunction as MetaFunction,
+} from "@remix-run/server-runtime";
import { Root } from "~/shared/remix";
import env from "~/env/env.public.server";
import { getThemeData } from "~/shared/theme";
import type { ShouldRevalidateFunction } from "@remix-run/react";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
return {
env,
theme: await getThemeData(request),
diff --git a/apps/builder/app/routes/cgi.image.$name.ts b/apps/builder/app/routes/cgi.image.$name.ts
index cc53432506..6680ff9cdf 100644
--- a/apps/builder/app/routes/cgi.image.$name.ts
+++ b/apps/builder/app/routes/cgi.image.$name.ts
@@ -1,12 +1,13 @@
import { createReadStream } from "node:fs";
import { join } from "node:path";
-import { type LoaderArgs, Response } from "@remix-run/node";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
+import { Response } from "@remix-run/node";
import env from "~/env/env.server";
// this route used as proxy for images to cloudflare endpoint
// https://developers.cloudflare.com/fundamentals/get-started/reference/cdn-cgi-endpoint/
-export const loader = async ({ params, request }: LoaderArgs) => {
+export const loader = async ({ params, request }: LoaderFunctionArgs) => {
const { name } = params;
if (name === undefined) {
throw Error("Name is undefined");
diff --git a/apps/builder/app/routes/dashboard._index.tsx b/apps/builder/app/routes/dashboard._index.tsx
index 9beb1ff2f5..6449ea7999 100644
--- a/apps/builder/app/routes/dashboard._index.tsx
+++ b/apps/builder/app/routes/dashboard._index.tsx
@@ -1,7 +1,6 @@
import { type ComponentProps } from "react";
import { useLoaderData, useRouteError } from "@remix-run/react";
-import type { LoaderArgs } from "@remix-run/node";
-import { redirect } from "@remix-run/node";
+import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
import { dashboardProjectRouter } from "@webstudio-is/dashboard/index.server";
import { Dashboard } from "~/dashboard";
import { findAuthenticatedUser } from "~/services/auth.server";
@@ -12,7 +11,7 @@ import { createContext } from "~/shared/context.server";
import env from "~/env/env.server";
export const loader = async ({
request,
-}: LoaderArgs): Promise<ComponentProps<typeof Dashboard>> => {
+}: LoaderFunctionArgs): Promise<ComponentProps<typeof Dashboard>> => {
const user = await findAuthenticatedUser(request);
if (user === null) {
diff --git a/apps/builder/app/routes/dashboard.tsx b/apps/builder/app/routes/dashboard.tsx
index f326c45edb..bd8e634ffe 100644
--- a/apps/builder/app/routes/dashboard.tsx
+++ b/apps/builder/app/routes/dashboard.tsx
@@ -1,12 +1,12 @@
import type {
- LoaderArgs,
- V2_MetaFunction as MetaFunction,
-} from "@remix-run/node";
+ LoaderFunctionArgs,
+ V2_ServerRuntimeMetaFunction as MetaFunction,
+} from "@remix-run/server-runtime";
import { Root } from "~/shared/remix";
import env from "~/env/env.public.server";
import { getThemeData } from "~/shared/theme";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
return {
env,
theme: await getThemeData(request),
diff --git a/apps/builder/app/routes/login._index.tsx b/apps/builder/app/routes/login._index.tsx
index 7c0a61a669..407a37652b 100644
--- a/apps/builder/app/routes/login._index.tsx
+++ b/apps/builder/app/routes/login._index.tsx
@@ -1,10 +1,10 @@
import type { ComponentProps } from "react";
import {
- type LoaderArgs,
+ type LoaderFunctionArgs,
type TypedResponse,
redirect,
json,
-} from "@remix-run/node";
+} from "@remix-run/server-runtime";
import { useLoaderData } from "@remix-run/react";
import { findAuthenticatedUser } from "~/services/auth.server";
import env from "~/env/env.server";
@@ -21,7 +21,9 @@ const comparePathnames = (pathnameOrUrlA: string, pathnameOrUrlB: string) => {
export const loader = async ({
request,
-}: LoaderArgs): Promise<TypedResponse<ComponentProps<typeof Login>>> => {
+}: LoaderFunctionArgs): Promise<
+ TypedResponse<ComponentProps<typeof Login>>
+> => {
const user = await findAuthenticatedUser(request);
const url = new URL(request.url);
diff --git a/apps/builder/app/routes/login.tsx b/apps/builder/app/routes/login.tsx
index a7a9de4022..07d964d3aa 100644
--- a/apps/builder/app/routes/login.tsx
+++ b/apps/builder/app/routes/login.tsx
@@ -1,12 +1,12 @@
import type {
- LoaderArgs,
- V2_MetaFunction as MetaFunction,
-} from "@remix-run/node";
+ LoaderFunctionArgs,
+ V2_ServerRuntimeMetaFunction as MetaFunction,
+} from "@remix-run/server-runtime";
import { Root } from "~/shared/remix";
import env from "~/env/env.public.server";
import { getThemeData } from "~/shared/theme";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
return {
env,
theme: await getThemeData(request),
diff --git a/apps/builder/app/routes/logout.tsx b/apps/builder/app/routes/logout.tsx
index 2c88769f82..27eb9c0dac 100644
--- a/apps/builder/app/routes/logout.tsx
+++ b/apps/builder/app/routes/logout.tsx
@@ -1,4 +1,4 @@
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import { authenticator } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
@@ -6,6 +6,6 @@ export default function Logout() {
return null;
}
-export const loader = async ({ request }: ActionArgs) => {
+export const loader = async ({ request }: ActionFunctionArgs) => {
await authenticator.logout(request, { redirectTo: loginPath({}) });
};
diff --git a/apps/builder/app/routes/n8n.$.tsx b/apps/builder/app/routes/n8n.$.tsx
index 85452d335c..826c47b9d8 100644
--- a/apps/builder/app/routes/n8n.$.tsx
+++ b/apps/builder/app/routes/n8n.$.tsx
@@ -1,10 +1,13 @@
-import { redirect } from "@remix-run/node";
+import {
+ type LoaderFunctionArgs,
+ json,
+ redirect,
+} from "@remix-run/server-runtime";
import { isRouteErrorResponse, useRouteError } from "@remix-run/react";
import { z } from "zod";
import { findAuthenticatedUser } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import env from "~/env/env.server";
-import { type LoaderArgs, json } from "@remix-run/server-runtime";
import cookie from "cookie";
const zN8NResponse = z.union([
@@ -23,7 +26,7 @@ const zWebhookEnv = z.object({
N8N_WEBHOOK_TOKEN: z.string(),
});
-export const loader = async ({ request, params }: LoaderArgs) => {
+export const loader = async ({ request, params }: LoaderFunctionArgs) => {
const user = await findAuthenticatedUser(request);
if (user === null) {
diff --git a/apps/builder/app/routes/n8n.tsx b/apps/builder/app/routes/n8n.tsx
index 983c0c010c..c9148a45de 100644
--- a/apps/builder/app/routes/n8n.tsx
+++ b/apps/builder/app/routes/n8n.tsx
@@ -1,12 +1,12 @@
import type {
- LoaderArgs,
- V2_MetaFunction as MetaFunction,
-} from "@remix-run/node";
+ LoaderFunctionArgs,
+ V2_ServerRuntimeMetaFunction as MetaFunction,
+} from "@remix-run/server-runtime";
import { Root } from "~/shared/remix";
import env from "~/env/env.public.server";
import { getThemeData } from "~/shared/theme";
-export const loader = async ({ request }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
return {
env,
theme: await getThemeData(request),
diff --git a/apps/builder/app/routes/rest.ai._index.ts b/apps/builder/app/routes/rest.ai._index.ts
index c5a70dbc6f..d5c587427f 100644
--- a/apps/builder/app/routes/rest.ai._index.ts
+++ b/apps/builder/app/routes/rest.ai._index.ts
@@ -1,5 +1,5 @@
import { z } from "zod";
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import {
copywriter,
operations,
@@ -40,7 +40,7 @@ export const config = {
maxDuration: 180, // seconds
};
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
// @todo Reinstate isFeatureEnabled('ai')
if (env.OPENAI_KEY === undefined) {
diff --git a/apps/builder/app/routes/rest.ai.audio.transcriptions.ts b/apps/builder/app/routes/rest.ai.audio.transcriptions.ts
index 4e09a7c7c5..2cb8b60787 100644
--- a/apps/builder/app/routes/rest.ai.audio.transcriptions.ts
+++ b/apps/builder/app/routes/rest.ai.audio.transcriptions.ts
@@ -1,4 +1,4 @@
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import { z } from "zod";
const zTranscription = z.object({
@@ -6,7 +6,7 @@ const zTranscription = z.object({
});
// @todo: move to AI package
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
// @todo: validate request
const formData = await request.formData();
formData.append("model", "whisper-1");
diff --git a/apps/builder/app/routes/rest.ai.detect.ts b/apps/builder/app/routes/rest.ai.detect.ts
index f37fe2f1d5..aade629c62 100644
--- a/apps/builder/app/routes/rest.ai.detect.ts
+++ b/apps/builder/app/routes/rest.ai.detect.ts
@@ -1,5 +1,5 @@
import { z } from "zod";
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import {
commandDetect,
createGptModel,
@@ -16,7 +16,7 @@ export const RequestParamsSchema = z.object({
prompt: z.string().max(1200),
});
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
// @todo Reinstate isFeatureEnabled('ai')
if (env.OPENAI_KEY === undefined) {
diff --git a/apps/builder/app/routes/rest.assets.$name.tsx b/apps/builder/app/routes/rest.assets.$name.tsx
index 13ea36c517..1166fafc35 100644
--- a/apps/builder/app/routes/rest.assets.$name.tsx
+++ b/apps/builder/app/routes/rest.assets.$name.tsx
@@ -1,4 +1,4 @@
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import type { Asset } from "@webstudio-is/sdk";
import { uploadFile } from "@webstudio-is/asset-uploader/index.server";
import type { ActionData } from "~/builder/shared/assets";
@@ -6,7 +6,7 @@ import { sentryException } from "~/shared/sentry";
import { createAssetClient } from "~/shared/asset-client";
export const action = async (
- props: ActionArgs
+ props: ActionFunctionArgs
): Promise<ActionData | Array<Asset> | undefined> => {
const { request, params } = props;
diff --git a/apps/builder/app/routes/rest.assets.tsx b/apps/builder/app/routes/rest.assets.tsx
index 33ab8bf53d..3749ba1380 100644
--- a/apps/builder/app/routes/rest.assets.tsx
+++ b/apps/builder/app/routes/rest.assets.tsx
@@ -1,4 +1,7 @@
-import type { ActionArgs, LoaderArgs } from "@remix-run/node";
+import type {
+ ActionFunctionArgs,
+ LoaderFunctionArgs,
+} from "@remix-run/server-runtime";
import type { Asset } from "@webstudio-is/sdk";
import { MaxAssets } from "@webstudio-is/asset-uploader";
import {
@@ -12,7 +15,7 @@ import env from "~/env/env.server";
export const loader = async ({
params,
request,
-}: LoaderArgs): Promise<Array<Asset>> => {
+}: LoaderFunctionArgs): Promise<Array<Asset>> => {
if (params.projectId === undefined) {
throw new Error("Project id undefined");
}
@@ -20,7 +23,7 @@ export const loader = async ({
return await loadAssetsByProject(params.projectId, context);
};
-export const action = async (props: ActionArgs) => {
+export const action = async (props: ActionFunctionArgs) => {
const { request } = props;
const context = await createContext(request);
diff --git a/apps/builder/app/routes/rest.build.$buildId.tsx b/apps/builder/app/routes/rest.build.$buildId.tsx
index d61b6d5234..81e881e2e7 100644
--- a/apps/builder/app/routes/rest.build.$buildId.tsx
+++ b/apps/builder/app/routes/rest.build.$buildId.tsx
@@ -1,4 +1,4 @@
-import { json, type LoaderArgs } from "@remix-run/node";
+import { json, type LoaderFunctionArgs } from "@remix-run/server-runtime";
import type { Data } from "@webstudio-is/http-client";
import { db as projectDb } from "@webstudio-is/project/index.server";
import { sentryException } from "~/shared/sentry";
@@ -9,7 +9,7 @@ import { getUserById, type User } from "~/shared/db/user.server";
export const loader = async ({
params,
request,
-}: LoaderArgs): Promise<
+}: LoaderFunctionArgs): Promise<
Data & { user: { email: User["email"] } | undefined } & {
projectDomain: string;
}
diff --git a/apps/builder/app/routes/rest.buildId.$projectId.tsx b/apps/builder/app/routes/rest.buildId.$projectId.tsx
index f9da3c73e7..b750388654 100644
--- a/apps/builder/app/routes/rest.buildId.$projectId.tsx
+++ b/apps/builder/app/routes/rest.buildId.$projectId.tsx
@@ -1,4 +1,4 @@
-import { json, type LoaderArgs } from "@remix-run/node";
+import { json, type LoaderFunctionArgs } from "@remix-run/server-runtime";
import { db as projectDb } from "@webstudio-is/project/index.server";
import { sentryException } from "~/shared/sentry";
import { createContext } from "~/shared/context.server";
@@ -6,7 +6,7 @@ import { createContext } from "~/shared/context.server";
export const loader = async ({
params,
request,
-}: LoaderArgs): Promise<{ buildId: string | null }> => {
+}: LoaderFunctionArgs): Promise<{ buildId: string | null }> => {
try {
const projectId = params.projectId;
diff --git a/apps/builder/app/routes/rest.current.products.ts b/apps/builder/app/routes/rest.current.products.ts
index 512ccae5fc..8ab15d15d7 100644
--- a/apps/builder/app/routes/rest.current.products.ts
+++ b/apps/builder/app/routes/rest.current.products.ts
@@ -1,4 +1,8 @@
-import { json, redirect, type LoaderArgs } from "@remix-run/server-runtime";
+import {
+ json,
+ redirect,
+ type LoaderFunctionArgs,
+} from "@remix-run/server-runtime";
import { findAuthenticatedUser } from "~/services/auth.server";
import { loginPath } from "~/shared/router-utils";
import { prisma } from "@webstudio-is/prisma-client";
@@ -7,7 +11,7 @@ import { prisma } from "@webstudio-is/prisma-client";
* Created for ebugging purposes, to check that payments and products are working
* Showing current user's checkouts with products.
*/
-export const loader = async ({ request, params }: LoaderArgs) => {
+export const loader = async ({ request }: LoaderFunctionArgs) => {
const user = await findAuthenticatedUser(request);
if (user === null) {
diff --git a/apps/builder/app/routes/rest.patch.ts b/apps/builder/app/routes/rest.patch.ts
index e1e2e1771d..151dddfe84 100644
--- a/apps/builder/app/routes/rest.patch.ts
+++ b/apps/builder/app/routes/rest.patch.ts
@@ -1,5 +1,5 @@
import { applyPatches } from "immer";
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import type { SyncItem } from "immerhin";
import { prisma } from "@webstudio-is/prisma-client";
import {
@@ -45,7 +45,7 @@ type PatchData = {
version: number;
};
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
try {
const {
buildId,
diff --git a/apps/builder/app/routes/rest.resources-loader.ts b/apps/builder/app/routes/rest.resources-loader.ts
index 9d973d991a..3601cd2a2a 100644
--- a/apps/builder/app/routes/rest.resources-loader.ts
+++ b/apps/builder/app/routes/rest.resources-loader.ts
@@ -1,8 +1,8 @@
import { z } from "zod";
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import { loadResource, ResourceRequest } from "@webstudio-is/sdk";
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
const computedResources = z
.array(ResourceRequest)
.parse(await request.json());
diff --git a/apps/builder/app/routes/rest.theme.$setting.ts b/apps/builder/app/routes/rest.theme.$setting.ts
index 3ad5b0dfdd..4fb1ec639c 100644
--- a/apps/builder/app/routes/rest.theme.$setting.ts
+++ b/apps/builder/app/routes/rest.theme.$setting.ts
@@ -1,7 +1,7 @@
-import { json, type LoaderArgs } from "@remix-run/node";
+import { json, type LoaderFunctionArgs } from "@remix-run/server-runtime";
import { themeCookieParser } from "~/shared/theme";
-export const loader = async ({ params }: LoaderArgs) => {
+export const loader = async ({ params }: LoaderFunctionArgs) => {
const { setting } = params;
const headers = {
"Set-Cookie": await themeCookieParser.serialize(setting),
diff --git a/apps/builder/app/routes/trpc.$.ts b/apps/builder/app/routes/trpc.$.ts
index f5b4e8dafe..b57954d08a 100644
--- a/apps/builder/app/routes/trpc.$.ts
+++ b/apps/builder/app/routes/trpc.$.ts
@@ -1,11 +1,11 @@
// eslint-disable-next-line import/no-internal-modules
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
-import type { ActionArgs } from "@remix-run/node";
+import type { ActionFunctionArgs } from "@remix-run/server-runtime";
import { findAuthenticatedUser } from "~/services/auth.server";
import { createContext } from "~/shared/context.server";
import { appRouter } from "~/services/trcp-router.server";
-export const action = async ({ request }: ActionArgs) => {
+export const action = async ({ request }: ActionFunctionArgs) => {
const authenticatedUser = await findAuthenticatedUser(request);
if (authenticatedUser === null) {
diff --git a/apps/builder/app/routes/vercel-deploy-workaround.tsx b/apps/builder/app/routes/vercel-deploy-workaround.tsx
index 22534b571b..928c386065 100644
--- a/apps/builder/app/routes/vercel-deploy-workaround.tsx
+++ b/apps/builder/app/routes/vercel-deploy-workaround.tsx
@@ -1,4 +1,4 @@
-import type { LinksFunction } from "@remix-run/node";
+import type { LinksFunction } from "@remix-run/server-runtime";
import { Root } from "~/shared/remix";
import interFont from "@fontsource-variable/inter/index.css";
diff --git a/apps/builder/remix.env.d.ts b/apps/builder/remix.env.d.ts
index 72e2affe31..90b68ce1d0 100644
--- a/apps/builder/remix.env.d.ts
+++ b/apps/builder/remix.env.d.ts
@@ -1,2 +1,9 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node/globals" />
+
+import type { LoaderArgs, ActionArgs } from "@remix-run/server-runtime";
+
+declare module "@remix-run/server-runtime" {
+ export type LoaderFunctionArgs = LoaderArgs;
+ export type ActionFunctionArgs = ActionArgs;
+}
diff --git a/fixtures/webstudio-custom-template/app/routes/[hello]._index.ts b/fixtures/webstudio-custom-template/app/routes/[hello]._index.ts
index ed9261af6d..42905d5320 100644
--- a/fixtures/webstudio-custom-template/app/routes/[hello]._index.ts
+++ b/fixtures/webstudio-custom-template/app/routes/[hello]._index.ts
@@ -1,5 +1,5 @@
-import { type LoaderArgs, redirect } from "@remix-run/server-runtime";
+import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
return redirect("/world", 301);
};
diff --git a/fixtures/webstudio-custom-template/app/routes/[robots.txt].tsx b/fixtures/webstudio-custom-template/app/routes/[robots.txt].tsx
index a2be4a2ad3..aad4a9b368 100644
--- a/fixtures/webstudio-custom-template/app/routes/[robots.txt].tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[robots.txt].tsx
@@ -1,6 +1,6 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
index a533ffd48f..2cfbde04fd 100644
--- a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-custom-template/app/routes/[sitemap.xml].tsx b/fixtures/webstudio-custom-template/app/routes/[sitemap.xml].tsx
index bf4846a0d3..84eeacd35f 100644
--- a/fixtures/webstudio-custom-template/app/routes/[sitemap.xml].tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[sitemap.xml].tsx
@@ -1,7 +1,7 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import { sitemap } from "../__generated__/[sitemap.xml]";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
index a61d76eb64..312059829c 100644
--- a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-custom-template/app/routes/_index.tsx b/fixtures/webstudio-custom-template/app/routes/_index.tsx
index 40b5f2c09f..8f97024ed8 100644
--- a/fixtures/webstudio-custom-template/app/routes/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/_index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-custom-template/remix.env.d.ts b/fixtures/webstudio-custom-template/remix.env.d.ts
index dcf8c45e1d..9b43aea350 100644
--- a/fixtures/webstudio-custom-template/remix.env.d.ts
+++ b/fixtures/webstudio-custom-template/remix.env.d.ts
@@ -1,2 +1,9 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node" />
+
+import type { LoaderArgs, ActionArgs } from "@remix-run/server-runtime";
+
+declare module "@remix-run/server-runtime" {
+ export type LoaderFunctionArgs = LoaderArgs;
+ export type ActionFunctionArgs = ActionArgs;
+}
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[robots.txt].tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[robots.txt].tsx
index a2be4a2ad3..aad4a9b368 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[robots.txt].tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[robots.txt].tsx
@@ -1,6 +1,6 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[sitemap.xml].tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[sitemap.xml].tsx
index bf4846a0d3..84eeacd35f 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[sitemap.xml].tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/[sitemap.xml].tsx
@@ -1,7 +1,7 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import { sitemap } from "../__generated__/[sitemap.xml]";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
index 40b5f2c09f..8f97024ed8 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts b/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts
index dcf8c45e1d..9b43aea350 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts
+++ b/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts
@@ -1,2 +1,9 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node" />
+
+import type { LoaderArgs, ActionArgs } from "@remix-run/server-runtime";
+
+declare module "@remix-run/server-runtime" {
+ export type LoaderFunctionArgs = LoaderArgs;
+ export type ActionFunctionArgs = ActionArgs;
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/[robots.txt].tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/[robots.txt].tsx
index a2be4a2ad3..aad4a9b368 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/routes/[robots.txt].tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/[robots.txt].tsx
@@ -1,6 +1,6 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/[sitemap.xml].tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/[sitemap.xml].tsx
index bf4846a0d3..84eeacd35f 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/routes/[sitemap.xml].tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/[sitemap.xml].tsx
@@ -1,7 +1,7 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import { sitemap } from "../__generated__/[sitemap.xml]";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
index 40b5f2c09f..8f97024ed8 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts b/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts
index dcf8c45e1d..9b43aea350 100644
--- a/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts
+++ b/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts
@@ -1,2 +1,9 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node" />
+
+import type { LoaderArgs, ActionArgs } from "@remix-run/server-runtime";
+
+declare module "@remix-run/server-runtime" {
+ export type LoaderFunctionArgs = LoaderArgs;
+ export type ActionFunctionArgs = ActionArgs;
+}
diff --git a/fixtures/webstudio-remix-vercel/app/framework.ts b/fixtures/webstudio-remix-vercel/app/framework.ts
deleted file mode 100644
index 1364cdaf6f..0000000000
--- a/fixtures/webstudio-remix-vercel/app/framework.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-/* eslint-disable camelcase */
-
-export {
- type V2_MetaFunction,
- type LinksFunction,
- type LinkDescriptor,
- type ActionArgs,
- json,
-} from "@remix-run/node";
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
index 94c19f5c05..2d5fc97184 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
index 65e00d96fe..8ffb13b0af 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
index ecc0c33059..3edc2d2617 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx
index d31f667a51..c48581fa24 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
index 0151675274..156bdc628a 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
index 7f1448604d..d6a310c7fc 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[robots.txt].tsx b/fixtures/webstudio-remix-vercel/app/routes/[robots.txt].tsx
index a2be4a2ad3..aad4a9b368 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[robots.txt].tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[robots.txt].tsx
@@ -1,6 +1,6 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[sitemap.xml].tsx b/fixtures/webstudio-remix-vercel/app/routes/[sitemap.xml].tsx
index bf4846a0d3..84eeacd35f 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[sitemap.xml].tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[sitemap.xml].tsx
@@ -1,7 +1,7 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import { sitemap } from "../__generated__/[sitemap.xml]";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
index 40b5f2c09f..8f97024ed8 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/fixtures/webstudio-remix-vercel/remix.env.d.ts b/fixtures/webstudio-remix-vercel/remix.env.d.ts
index dcf8c45e1d..9b43aea350 100644
--- a/fixtures/webstudio-remix-vercel/remix.env.d.ts
+++ b/fixtures/webstudio-remix-vercel/remix.env.d.ts
@@ -1,2 +1,9 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node" />
+
+import type { LoaderArgs, ActionArgs } from "@remix-run/server-runtime";
+
+declare module "@remix-run/server-runtime" {
+ export type LoaderFunctionArgs = LoaderArgs;
+ export type ActionFunctionArgs = ActionArgs;
+}
diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.ts
index c80d593069..1182dad734 100644
--- a/packages/cli/src/prebuild.ts
+++ b/packages/cli/src/prebuild.ts
@@ -713,9 +713,9 @@ export const projectMeta: ProjectMeta =
const redirectPagePath = generateRemixRoute(redirect.old);
const redirectFileName = `${redirectPagePath}.ts`;
- const content = `import { type LoaderArgs, redirect } from "@remix-run/server-runtime";
+ const content = `import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
return redirect("${redirect.new}", ${redirect.status ?? 301});
};
`;
diff --git a/packages/cli/templates/defaults/__templates__/route-template.tsx b/packages/cli/templates/defaults/__templates__/route-template.tsx
index 2f2b93940a..19c542a45b 100644
--- a/packages/cli/templates/defaults/__templates__/route-template.tsx
+++ b/packages/cli/templates/defaults/__templates__/route-template.tsx
@@ -1,11 +1,11 @@
/* eslint-disable camelcase */
import {
- type V2_ServerRuntimeMetaFunction,
+ type V2_ServerRuntimeMetaFunction as MetaFunction,
type LinksFunction,
type LinkDescriptor,
- type ActionArgs,
- type LoaderArgs,
- type HeadersArgs,
+ type ActionFunctionArgs,
+ type LoaderFunctionArgs,
+ type HeadersFunction,
json,
redirect,
} from "@remix-run/server-runtime";
@@ -32,7 +32,7 @@ import {
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
-export const loader = async (arg: LoaderArgs) => {
+export const loader = async (arg: LoaderFunctionArgs) => {
const url = new URL(arg.request.url);
const params = getRemixParams(arg.params);
const system = {
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
);
};
-export const headers = ({ loaderHeaders }: HeadersArgs) => {
+export const headers: HeadersFunction = ({ loaderHeaders }) => {
return {
"Cache-Control": "public, max-age=0, must-revalidate",
- "x-ws-language": loaderHeaders.get("x-ws-language"),
+ "x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
};
};
-export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
- const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [];
+export const meta: MetaFunction<typeof loader> = ({ data }) => {
+ const metas: ReturnType<MetaFunction> = [];
if (data === undefined) {
return metas;
}
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
}
};
-export const action = async ({ request, context }: ActionArgs) => {
+export const action = async ({ request, context }: ActionFunctionArgs) => {
const formData = await request.formData();
const formId = getFormId(formData);
diff --git a/packages/cli/templates/defaults/app/routes/[robots.txt].tsx b/packages/cli/templates/defaults/app/routes/[robots.txt].tsx
index a2be4a2ad3..aad4a9b368 100644
--- a/packages/cli/templates/defaults/app/routes/[robots.txt].tsx
+++ b/packages/cli/templates/defaults/app/routes/[robots.txt].tsx
@@ -1,6 +1,6 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/packages/cli/templates/defaults/app/routes/[sitemap.xml].tsx b/packages/cli/templates/defaults/app/routes/[sitemap.xml].tsx
index bf4846a0d3..84eeacd35f 100644
--- a/packages/cli/templates/defaults/app/routes/[sitemap.xml].tsx
+++ b/packages/cli/templates/defaults/app/routes/[sitemap.xml].tsx
@@ -1,7 +1,7 @@
-import type { LoaderArgs } from "@remix-run/server-runtime";
+import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
import { sitemap } from "../__generated__/[sitemap.xml]";
-export const loader = (arg: LoaderArgs) => {
+export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
diff --git a/packages/cli/templates/defaults/remix.env.d.ts b/packages/cli/templates/defaults/remix.env.d.ts
index dcf8c45e1d..9b43aea350 100644
--- a/packages/cli/templates/defaults/remix.env.d.ts
+++ b/packages/cli/templates/defaults/remix.env.d.ts
@@ -1,2 +1,9 @@
/// <reference types="@remix-run/dev" />
/// <reference types="@remix-run/node" />
+
+import type { LoaderArgs, ActionArgs } from "@remix-run/server-runtime";
+
+declare module "@remix-run/server-runtime" {
+ export type LoaderFunctionArgs = LoaderArgs;
+ export type ActionFunctionArgs = ActionArgs;
+}