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: move forms properties into server module (#3034)

Bogdan Chadkin20df0cef3235
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx
index 456e8c8599..fd55b9af06 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Script Test",
+ description: "",
+ excludePageFromSearch: false,
+ language: undefined,
+ socialImageAssetId: "",
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
index b36172ec0f..9edc4e0608 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import {
Body as Body,
Link as Link,
@@ -49,26 +47,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Script Test",
- description: "",
- excludePageFromSearch: false,
- language: undefined,
- socialImageAssetId: "",
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body
@@ -91,13 +69,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx
index 456e8c8599..a1440970c4 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Untitled",
+ description: "",
+ excludePageFromSearch: false,
+ language: "ru",
+ socialImageAssetId: undefined,
+ socialImageUrl: "",
+ status: 200,
+ redirect: "",
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx
index d02059e30d..c32cfde06e 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import { Heading as Heading } from "@webstudio-is/sdk-components-react";
@@ -46,26 +44,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Untitled",
- description: "",
- excludePageFromSearch: false,
- language: "ru",
- socialImageAssetId: undefined,
- socialImageUrl: "",
- status: 200,
- redirect: "",
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body data-ws-id="jDb2FuSK2-azIZxkH5XNv" data-ws-component="Body">
@@ -77,13 +55,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx
index 456e8c8599..e61b4399dd 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Site Title",
+ description: "Page description f511c297-b44f-4e4b-96bd-d013da06bada",
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: undefined,
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
index 220046d44b..08a3d4c835 100644
--- a/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/__generated__/_index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import {
Body as Body,
Link as Link,
@@ -81,26 +79,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Site Title",
- description: "Page description f511c297-b44f-4e4b-96bd-d013da06bada",
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: undefined,
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body
@@ -178,13 +156,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
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 f5341b1de6..74a8708561 100644
--- a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[script-test]._index";
-import { loadResources } from "../__generated__/[script-test]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[script-test]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
index 24fa36b1f1..d5a12595ac 100644
--- a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[world]._index";
-import { loadResources } from "../__generated__/[world]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[world]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-custom-template/app/routes/_index.tsx b/fixtures/webstudio-custom-template/app/routes/_index.tsx
index 4d787752c9..e3c5343ebb 100644
--- a/fixtures/webstudio-custom-template/app/routes/_index.tsx
+++ b/fixtures/webstudio-custom-template/app/routes/_index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/_index";
-import { loadResources } from "../__generated__/_index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/_index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx
index 456e8c8599..84b6b8bbad 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Home",
+ description: undefined,
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: undefined,
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
index a30b6c0135..74ff1ff7a4 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import {
Heading as Heading,
@@ -33,26 +31,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Home",
- description: undefined,
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: undefined,
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body
@@ -71,13 +49,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
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 4d787752c9..e3c5343ebb 100644
--- a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/_index";
-import { loadResources } from "../__generated__/_index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/_index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx
index 456e8c8599..84b6b8bbad 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Home",
+ description: undefined,
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: undefined,
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
index a30b6c0135..74ff1ff7a4 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import {
Heading as Heading,
@@ -33,26 +31,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Home",
- description: undefined,
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: undefined,
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body
@@ -71,13 +49,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
index 4d787752c9..e3c5343ebb 100644
--- a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/_index";
-import { loadResources } from "../__generated__/_index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/_index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx
index 456e8c8599..6eaafbb02b 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "RouteWithSymbols",
+ description: "",
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: undefined,
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx
index bb8d7cf6e4..80fbd2adbd 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import { Image as Image } from "@webstudio-is/sdk-components-react";
@@ -68,26 +66,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "RouteWithSymbols",
- description: "",
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: undefined,
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body data-ws-id="EDEfpMPRqDejthtwkH7ws" data-ws-component="Body">
@@ -102,13 +80,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx
index 456e8c8599..3eec3dd260 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx
@@ -1,4 +1,38 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "form",
+ description: "",
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: undefined,
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([
+ ["isNSM3wXcnHFikwNPlEOL", { method: "get", action: "/custom" }],
+]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
index 5f4d7d20cd..3827ad3580 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import {
Body as Body,
Form as Form,
@@ -77,26 +75,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "form",
- description: "",
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: undefined,
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
let [formState, set$formState] = useState<any>("initial");
let [formState_1, set$formState_1] = useState<any>("initial");
@@ -215,13 +193,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([["isNSM3wXcnHFikwNPlEOL", { method: "get", action: "/custom" }]]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx
index 456e8c8599..9f760c9cd4 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "heading-with-id",
+ description: "",
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: undefined,
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
index 85909ee231..cfe484b299 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import { Heading as Heading } from "@webstudio-is/sdk-components-react";
@@ -68,26 +66,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "heading-with-id",
- description: "",
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: undefined,
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body data-ws-id="O-ljaGZQ0iRNTlEshMkgE" data-ws-component="Body">
@@ -103,13 +81,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx
index 456e8c8599..8eac62679d 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx
@@ -1,4 +1,36 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Nested Page",
+ description: "",
+ excludePageFromSearch: false,
+ language: undefined,
+ socialImageAssetId: "",
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx
index f6462c10f0..74cbbd1aaa 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import { Heading as Heading } from "@webstudio-is/sdk-components-react";
@@ -68,26 +66,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Nested Page",
- description: "",
- excludePageFromSearch: false,
- language: undefined,
- socialImageAssetId: "",
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body data-ws-id="L0ZXd5F9xk9Rsl9ORzIkJ" data-ws-component="Body">
@@ -99,13 +77,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx
index 456e8c8599..936aa3e149 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx
@@ -1,4 +1,37 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Radix Revelations: Unraveling the Feline Mystique",
+ description:
+ "Delve deep into the radix roots of feline behaviors. At KittyNoTouchy, we dissect the core essence, or 'radix', of what makes cats the enigmatic creatures they are. Join us as we explore the radix of their instincts, habits, and quirks.",
+ excludePageFromSearch: true,
+ language: undefined,
+ socialImageAssetId: "88d5e2ff-b8f2-4899-aaf8-dde4ade6da10",
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
index e28186830f..cb766dc965 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import {
Accordion as Accordion,
@@ -79,27 +77,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Radix Revelations: Unraveling the Feline Mystique",
- description:
- "Delve deep into the radix roots of feline behaviors. At KittyNoTouchy, we dissect the core essence, or 'radix', of what makes cats the enigmatic creatures they are. Join us as we explore the radix of their instincts, habits, and quirks.",
- excludePageFromSearch: true,
- language: undefined,
- socialImageAssetId: "88d5e2ff-b8f2-4899-aaf8-dde4ade6da10",
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
let [accordionValue, set$accordionValue] = useState<any>("0");
return (
@@ -250,13 +227,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx
index b8800a64ee..84987b91d6 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx
@@ -1,3 +1,7 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
const [list_1] = await Promise.all([
@@ -13,3 +17,31 @@ export const loadResources = async (_props: { system: System }) => {
list_1,
} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "resources",
+ description: "",
+ excludePageFromSearch: false,
+ language: undefined,
+ socialImageAssetId: "",
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx
index 1102d81ae1..50d6c905ac 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import { Body as Body } from "@webstudio-is/sdk-components-react-remix";
import {
Box as Box,
@@ -71,26 +69,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "resources",
- description: "",
- excludePageFromSearch: false,
- language: undefined,
- socialImageAssetId: "",
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [],
- };
-};
-
const Page = ({}: { system: any }) => {
let list = useResource("list_1");
return (
@@ -111,13 +89,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx
index 456e8c8599..a4e9ff503d 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx
@@ -1,4 +1,42 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import type { PageMeta } from "@webstudio-is/sdk";
import { loadResource, type System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({
+ system,
+ resources,
+}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "The Ultimate Cat Protection Zone",
+ description:
+ "Dive into the world of felines and discover why some whiskers are best left untouched. From intriguing cat behaviors to protective measures, \nKittyGuardedZone is your go-to hub for all things 'hands-off' in the cat realm.",
+ excludePageFromSearch: undefined,
+ language: undefined,
+ socialImageAssetId: "cd939c56-bcdd-4e64-bd9c-567a9bccd3da",
+ socialImageUrl: undefined,
+ status: undefined,
+ redirect: undefined,
+ custom: [
+ {
+ property: "fb:app_id",
+ content: "app_id_app_id_app_id",
+ },
+ ],
+ };
+};
+
+type FormProperties = { method?: string; action?: string };
+export const formsProperties = new Map<string, FormProperties>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
index a52c6c5665..5acdfe53cf 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
@@ -7,10 +7,8 @@ import type {
FontAsset,
ImageAsset,
ProjectMeta,
- System,
} from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
import {
Body as Body,
Link as Link,
@@ -77,32 +75,6 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
-export const getPageMeta = ({
- system,
- resources,
-}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "The Ultimate Cat Protection Zone",
- description:
- "Dive into the world of felines and discover why some whiskers are best left untouched. From intriguing cat behaviors to protective measures, \nKittyGuardedZone is your go-to hub for all things 'hands-off' in the cat realm.",
- excludePageFromSearch: undefined,
- language: undefined,
- socialImageAssetId: "cd939c56-bcdd-4e64-bd9c-567a9bccd3da",
- socialImageUrl: undefined,
- status: undefined,
- redirect: undefined,
- custom: [
- {
- property: "fb:app_id",
- content: "app_id_app_id_app_id",
- },
- ],
- };
-};
-
const Page = ({}: { system: any }) => {
return (
<Body
@@ -200,13 +172,3 @@ const Page = ({}: { system: any }) => {
};
export { Page };
-
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
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 827c29e6f4..234bd9f70d 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
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[_route_with_symbols_]._index";
-import { loadResources } from "../__generated__/[_route_with_symbols_]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[_route_with_symbols_]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
index 5a8e763826..6d609521e1 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[form]._index";
-import { loadResources } from "../__generated__/[form]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[form]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
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 27743a39dc..da59999d57 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
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[heading-with-id]._index";
-import { loadResources } from "../__generated__/[heading-with-id]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[heading-with-id]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
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 82dbeeb446..cb992fecd8 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
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[nested].[nested-page]._index";
-import { loadResources } from "../__generated__/[nested].[nested-page]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[nested].[nested-page]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
index ad6ae81528..1b46a0e574 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[radix]._index";
-import { loadResources } from "../__generated__/[radix]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[radix]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
index 0438f00a60..69c49cbf0e 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/[resources]._index";
-import { loadResources } from "../__generated__/[resources]._index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/[resources]._index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
index 4d787752c9..e3c5343ebb 100644
--- a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../__generated__/_index";
-import { loadResources } from "../__generated__/_index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../__generated__/_index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/packages/cli/__generated__/_index.server.tsx b/packages/cli/__generated__/_index.server.tsx
index e9b9795862..8aa01b0012 100644
--- a/packages/cli/__generated__/_index.server.tsx
+++ b/packages/cli/__generated__/_index.server.tsx
@@ -1,6 +1,26 @@
-import type { System } from "@webstudio-is/sdk";
+import type { PageMeta, System } from "@webstudio-is/sdk";
export const loadResources = async (_props: { system: System }) => {
const [] = await Promise.all([]);
return {} as Record<string, unknown>;
};
+
+export const getPageMeta = ({}: {
+ system: System;
+ resources: Record<string, any>;
+}): PageMeta => {
+ return {
+ title: "Page title",
+ custom: [],
+ };
+};
+
+export const formsProperties = new Map<
+ string,
+ { method?: string; action?: string }
+>([]);
+
+type Params = Record<string, string | undefined>;
+export const getRemixParams = ({ ...params }: Params): Params => {
+ return params;
+};
diff --git a/packages/cli/__generated__/_index.tsx b/packages/cli/__generated__/_index.tsx
index e2eafb154d..c8795f1f3b 100644
--- a/packages/cli/__generated__/_index.tsx
+++ b/packages/cli/__generated__/_index.tsx
@@ -1,9 +1,8 @@
/**
* The only intent of this file is to support typings inside ../templates/route-template for easier development.
**/
-import type { ImageAsset, FontAsset, System } from "@webstudio-is/sdk";
+import type { ImageAsset, FontAsset } from "@webstudio-is/sdk";
import type { PageData } from "../templates/defaults/__templates__/route-template";
-import type { PageMeta } from "@webstudio-is/react-sdk";
export const imageAssets: ImageAsset[] = [];
@@ -20,31 +19,11 @@ export const user: { email: string | null } | undefined = {
};
export const projectId = "project-id";
-export const getPageMeta = ({}: {
- system: System;
- resources: Record<string, any>;
-}): PageMeta => {
- return {
- title: "Page title",
- custom: [],
- };
-};
-
const Page = (_props: { system: any }) => {
return <></>;
};
export { Page };
-type Params = Record<string, string | undefined>;
-export const getRemixParams = ({ ...params }: Params): Params => {
- return params;
-};
-
-export const formsProperties = new Map<
- string,
- { method?: string; action?: string }
->([]);
-
export const pageFontAssets: FontAsset[] = [];
export const pageBackgroundImageAssets: ImageAsset[] = [];
diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.ts
index 00b053b11f..aaf84d6ed1 100644
--- a/packages/cli/src/prebuild.ts
+++ b/packages/cli/src/prebuild.ts
@@ -17,7 +17,6 @@ import ora from "ora";
import merge from "deepmerge";
import {
generateCss,
- generateUtilsExport,
generateWebstudioComponent,
getIndexesWithinAncestors,
namespaceMeta,
@@ -26,9 +25,7 @@ import {
normalizeProps,
generateRemixRoute,
generateRemixParams,
- generateResourcesLoader,
collectionComponent,
- generatePageMeta,
} from "@webstudio-is/react-sdk";
import type {
Instance,
@@ -47,6 +44,9 @@ import {
getPagePath,
parseComponentName,
executeExpression,
+ generateFormsProperties,
+ generateResourcesLoader,
+ generatePageMeta,
} from "@webstudio-is/sdk";
import type { Data } from "@webstudio-is/http-client";
import { createImageLoader } from "@webstudio-is/image";
@@ -515,17 +515,13 @@ export const prebuild = async (options: {
"useState",
"Fragment",
"useResource",
- "PageMeta",
- "createPageMeta",
"PageData",
"Asset",
"ProjectMeta",
- "System",
"fontAssets",
"pageData",
"user",
"projectId",
- "formsProperties",
"Page",
"_props",
]);
@@ -583,7 +579,6 @@ export const prebuild = async (options: {
const props = new Map(pageData.build.props);
const dataSources = new Map(pageData.build.dataSources);
const resources = new Map(pageData.build.resources);
- const utilsExport = generateUtilsExport({ props });
const pageComponent = generateWebstudioComponent({
scope,
name: "Page",
@@ -611,9 +606,8 @@ export const prebuild = async (options: {
const pageExports = `/* eslint-disable */
/* This is a auto generated file for building the project */ \n
import { Fragment, useState } from "react";
-import type { Asset, FontAsset, ImageAsset, ProjectMeta, System } from "@webstudio-is/sdk";
+import type { Asset, FontAsset, ImageAsset, ProjectMeta } from "@webstudio-is/sdk";
import { useResource } from "@webstudio-is/react-sdk";
-import type { PageMeta } from "@webstudio-is/react-sdk";
${componentImports}
import type { PageData } from "~/routes/_index";
export const imageAssets: ImageAsset[] = ${JSON.stringify(imageAssets)}
@@ -631,15 +625,30 @@ export const user: { email: string | null } | undefined = ${JSON.stringify(
)};
export const projectId = "${siteData.build.projectId}";
-${generatePageMeta({ globalScope: scope, page: pageData.page, dataSources })}
-
${pageComponent}
export { Page }
+`;
+ const serverExports = `/* eslint-disable */
+/* This is a auto generated file for building the project */ \n
-${generateRemixParams(pageData.page.path)}
+import type { PageMeta } from "@webstudio-is/sdk";
+${generateResourcesLoader({
+ scope,
+ page: pageData.page,
+ dataSources,
+ resources,
+})}
+
+${generatePageMeta({
+ globalScope: scope,
+ page: pageData.page,
+ dataSources,
+})}
+
+${generateFormsProperties(props)}
-${utilsExport}
+${generateRemixParams(pageData.page.path)}
`;
/*
@@ -673,12 +682,7 @@ ${utilsExport}
await ensureFileInPath(
join(generatedDir, `${remixRoute}.server.tsx`),
- generateResourcesLoader({
- scope,
- page: pageData.page,
- dataSources,
- resources,
- })
+ serverExports
);
}
diff --git a/packages/cli/templates/defaults/__templates__/route-template.tsx b/packages/cli/templates/defaults/__templates__/route-template.tsx
index 07760e0c59..f1e725cfd1 100644
--- a/packages/cli/templates/defaults/__templates__/route-template.tsx
+++ b/packages/cli/templates/defaults/__templates__/route-template.tsx
@@ -17,15 +17,17 @@ import {
pageData,
user,
projectId,
- formsProperties,
Page,
imageAssets,
- getRemixParams,
- getPageMeta,
pageFontAssets,
pageBackgroundImageAssets,
} from "../../../__generated__/_index";
-import { loadResources } from "../../../__generated__/_index.server";
+import {
+ formsProperties,
+ loadResources,
+ getPageMeta,
+ getRemixParams,
+} from "../../../__generated__/_index.server";
import css from "../__generated__/index.css";
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
diff --git a/packages/react-sdk/src/index.ts b/packages/react-sdk/src/index.ts
index 10a8b95d01..19c4c047ea 100644
--- a/packages/react-sdk/src/index.ts
+++ b/packages/react-sdk/src/index.ts
@@ -19,11 +19,8 @@ export * from "./props";
export * from "./context";
export { getIndexesWithinAncestors } from "./instance-utils";
export * from "./hook";
-export { generateUtilsExport } from "./generator";
export {
generateWebstudioComponent,
generateJsxElement,
generateJsxChildren,
} from "./component-generator";
-export { generateResourcesLoader } from "./resources-generator";
-export * from "./page-meta-generator";
diff --git a/packages/react-sdk/src/generator.test.ts b/packages/sdk/src/forms-generator.test.ts
similarity index 60%
rename from packages/react-sdk/src/generator.test.ts
rename to packages/sdk/src/forms-generator.test.ts
index ae1f91925e..11d3496073 100644
--- a/packages/react-sdk/src/generator.test.ts
+++ b/packages/sdk/src/forms-generator.test.ts
@@ -1,10 +1,10 @@
import { expect, test } from "@jest/globals";
-import { generateUtilsExport } from "./generator";
+import { generateFormsProperties } from "./forms-generator";
test("generates forms properties", () => {
expect(
- generateUtilsExport({
- props: new Map([
+ generateFormsProperties(
+ new Map([
[
"method1Id",
{
@@ -37,23 +37,17 @@ test("generates forms properties", () => {
value: "/index.php",
},
],
- ]),
- })
+ ])
+ )
).toMatchInlineSnapshot(`
+"type FormProperties = { method?: string, action?: string }
+export const formsProperties = new Map<string, FormProperties>([["1",{"method":"post"}],["2",{"method":"get","action":"/index.php"}]])
"
- export const formsProperties = new Map<string, { method?: string, action?: string }>([["1",{"method":"post"}],["2",{"method":"get","action":"/index.php"}]])
- "
`);
-});
-test("generates list of pages paths", () => {
- expect(
- generateUtilsExport({
- props: new Map(),
- })
- ).toMatchInlineSnapshot(`
+ expect(generateFormsProperties(new Map())).toMatchInlineSnapshot(`
+"type FormProperties = { method?: string, action?: string }
+export const formsProperties = new Map<string, FormProperties>([])
"
- export const formsProperties = new Map<string, { method?: string, action?: string }>([])
- "
`);
});
diff --git a/packages/react-sdk/src/generator.ts b/packages/sdk/src/forms-generator.ts
similarity index 56%
rename from packages/react-sdk/src/generator.ts
rename to packages/sdk/src/forms-generator.ts
index 2d29dca63b..b813a05ca4 100644
--- a/packages/react-sdk/src/generator.ts
+++ b/packages/sdk/src/forms-generator.ts
@@ -1,19 +1,15 @@
-import type { Props } from "@webstudio-is/sdk";
-
-type PageData = {
- props: Props;
-};
+import type { Props } from "./schema/props";
/**
* Generates data based utilities at build time
*/
-export const generateUtilsExport = (siteData: PageData) => {
+export const generateFormsProperties = (props: Props) => {
// method and action per instance extracted from props
const formsProperties = new Map<
string,
{ method?: string; action?: string }
>();
- for (const prop of siteData.props.values()) {
+ for (const prop of props.values()) {
if (prop.type === "string") {
if (prop.name === "action" || prop.name === "method") {
let properties = formsProperties.get(prop.instanceId);
@@ -25,11 +21,9 @@ export const generateUtilsExport = (siteData: PageData) => {
}
}
}
- const generatedFormsProperties = `export const formsProperties = new Map<string, { method?: string, action?: string }>(${JSON.stringify(
- Array.from(formsProperties.entries())
- )})`;
-
- return `
- ${generatedFormsProperties}
- `;
+ const entriesString = JSON.stringify(Array.from(formsProperties.entries()));
+ let generated = "";
+ generated += `type FormProperties = { method?: string, action?: string }\n`;
+ generated += `export const formsProperties = new Map<string, FormProperties>(${entriesString})\n`;
+ return generated;
};
diff --git a/packages/sdk/src/index.ts b/packages/sdk/src/index.ts
index 1a9ce34c5d..964c28ae31 100644
--- a/packages/sdk/src/index.ts
+++ b/packages/sdk/src/index.ts
@@ -16,3 +16,6 @@ export * from "./page-utils";
export * from "./scope";
export * from "./resource-loader";
export * from "./expression";
+export * from "./forms-generator";
+export * from "./resources-generator";
+export * from "./page-meta-generator";
diff --git a/packages/react-sdk/src/page-meta-generator.test.ts b/packages/sdk/src/page-meta-generator.test.ts
similarity index 99%
rename from packages/react-sdk/src/page-meta-generator.test.ts
rename to packages/sdk/src/page-meta-generator.test.ts
index 94a41ba816..376f82fb17 100644
--- a/packages/react-sdk/src/page-meta-generator.test.ts
+++ b/packages/sdk/src/page-meta-generator.test.ts
@@ -1,5 +1,5 @@
import { expect, test } from "@jest/globals";
-import { createScope } from "@webstudio-is/sdk";
+import { createScope } from "./scope";
import { generatePageMeta } from "./page-meta-generator";
const toMap = <T extends { id: string }>(list: T[]) =>
diff --git a/packages/react-sdk/src/page-meta-generator.ts b/packages/sdk/src/page-meta-generator.ts
similarity index 94%
rename from packages/react-sdk/src/page-meta-generator.ts
rename to packages/sdk/src/page-meta-generator.ts
index 92f482117c..c1593c9897 100644
--- a/packages/react-sdk/src/page-meta-generator.ts
+++ b/packages/sdk/src/page-meta-generator.ts
@@ -1,5 +1,8 @@
-import type { Asset, DataSources, Page, Scope } from "@webstudio-is/sdk";
-import { createScope, generateExpression } from "@webstudio-is/sdk";
+import type { Asset } from "./schema/assets";
+import type { DataSources } from "./schema/data-sources";
+import type { Page } from "./schema/pages";
+import { type Scope, createScope } from "./scope";
+import { generateExpression } from "./expression";
export type PageMeta = {
title: string;
diff --git a/packages/react-sdk/src/resources-generator.test.ts b/packages/sdk/src/resources-generator.test.ts
similarity index 98%
rename from packages/react-sdk/src/resources-generator.test.ts
rename to packages/sdk/src/resources-generator.test.ts
index e40c76fac4..81a54df37c 100644
--- a/packages/react-sdk/src/resources-generator.test.ts
+++ b/packages/sdk/src/resources-generator.test.ts
@@ -1,6 +1,7 @@
import { expect, test } from "@jest/globals";
import stripIndent from "strip-indent";
-import { createScope, type Page } from "@webstudio-is/sdk";
+import type { Page } from "./schema/pages";
+import { createScope } from "./scope";
import { generateResourcesLoader } from "./resources-generator";
const clear = (input: string) =>
diff --git a/packages/react-sdk/src/resources-generator.ts b/packages/sdk/src/resources-generator.ts
similarity index 92%
rename from packages/react-sdk/src/resources-generator.ts
rename to packages/sdk/src/resources-generator.ts
index a161370c42..b34f156c13 100644
--- a/packages/react-sdk/src/resources-generator.ts
+++ b/packages/sdk/src/resources-generator.ts
@@ -1,5 +1,8 @@
-import type { DataSources, Page, Resources, Scope } from "@webstudio-is/sdk";
-import { generateExpression } from "@webstudio-is/sdk";
+import type { DataSources } from "./schema/data-sources";
+import type { Page } from "./schema/pages";
+import type { Resources } from "./schema/resources";
+import type { Scope } from "./scope";
+import { generateExpression } from "./expression";
export const generateResourcesLoader = ({
scope,