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.

feat: Allow export to netlify using `functions` and `edge-functions` as templates from cli (#2346)

Jaya Krishna Namburufa737213555b
diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml
index 91b82ba86e..689a38b0ab 100644
--- a/.github/workflows/cli-test.yml
+++ b/.github/workflows/cli-test.yml
@@ -38,22 +38,62 @@ jobs:
- name: Build cli
run: pnpm turbo run build --filter='webstudio-cli'
+ # Testing fixtures for vercel template
- name: Test cli --help flag
working-directory: ./fixtures/webstudio-remix-vercel
run: pnpm webstudio-cli --help
- - name: Test cli link command
+ - name: Test cli link command for vercel
working-directory: ./fixtures/webstudio-remix-vercel
run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/cddc1d44-af37-4cb6-a430-d300cf6f932d?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d'
- - name: Test cli sync command
+ - name: Test cli sync command for vercel
working-directory: ./fixtures/webstudio-remix-vercel
run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
- - name: Test cli build command
+ - name: Test cli build command for vercel
working-directory: ./fixtures/webstudio-remix-vercel
run: pnpm webstudio-cli build --preview && pnpm prettier --write ./app/ ./package.json
+ # Testing fixtures for netlify-functions template
+ - name: Test cli link command for netlify-functions
+ working-directory: ./fixtures/webstudio-remix-netlify-functions
+ run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/d845c167-ea07-4875-b08d-83e97c09dcce?authToken=e9d1343f-9298-4fd3-a66e-f89a5af2dd93'
+
+ - name: Test cli sync command for netlify-functions
+ working-directory: ./fixtures/webstudio-remix-netlify-functions
+ run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
+
+ - name: Test cli build command for netlify-functions
+ working-directory: ./fixtures/webstudio-remix-netlify-functions
+ run: pnpm webstudio-cli build --template netlify-functions --preview && pnpm prettier --write ./app/ ./package.json
+
+ # Testing fixtures for netlify-edge-functions template
+ - name: Test cli link command for netlify-edge-functions
+ working-directory: ./fixtures/webstudio-remix-netlify-edge-functions
+ run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/d845c167-ea07-4875-b08d-83e97c09dcce?authToken=e9d1343f-9298-4fd3-a66e-f89a5af2dd93&'
+
+ - name: Test cli sync command for netlify-edge-functions
+ working-directory: ./fixtures/webstudio-remix-netlify-edge-functions
+ run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
+
+ - name: Test cli build command for netlify-edge-functions
+ working-directory: ./fixtures/webstudio-remix-netlify-edge-functions
+ run: pnpm webstudio-cli build --template netlify-edge-functions --preview && pnpm prettier --write ./app/ ./package.json
+
+ # Testing fixtures for custom template
+ - name: Test cli link command for custom template
+ working-directory: ./fixtures/webstudio-custom-template
+ run: pnpm webstudio-cli link --link 'https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/cddc1d44-af37-4cb6-a430-d300cf6f932d?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d'
+
+ - name: Test cli sync command for custom template
+ working-directory: ./fixtures/webstudio-custom-template
+ run: pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/
+
+ - name: Test cli build command for custom template
+ working-directory: ./fixtures/webstudio-custom-template
+ run: pnpm webstudio-cli build --template ./custom-template --preview && pnpm prettier --write ./app/ ./package.json
+
- name: Test git diff
# This command will fail if there are uncommitted changes, i.e something has broken
run: git diff --name-only HEAD --exit-code
diff --git a/.gitignore b/.gitignore
index d4bdbd408a..73cf288c56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@ _build
.cache
.vercel
.output
+.netlify
# misc
.DS_Store
diff --git a/fixtures/webstudio-custom-template/app/constants.mjs b/fixtures/webstudio-custom-template/app/constants.mjs
index 86296ca05c..9cf6da7f7e 100644
--- a/fixtures/webstudio-custom-template/app/constants.mjs
+++ b/fixtures/webstudio-custom-template/app/constants.mjs
@@ -8,18 +8,6 @@ export const imageBaseUrl = "/custom-folder/";
/**
* @type {import("@webstudio-is/image").ImageLoader}
*/
-export const imageLoader = ({ quality, src, width }) => {
- if (process.env.NODE_ENV !== "production") {
- return imageBaseUrl + src;
- }
-
- // https://vercel.com/blog/build-your-own-web-framework#automatic-image-optimization
- return (
- "/_vercel/image?url=" +
- encodeURIComponent(imageBaseUrl + src) +
- "&w=" +
- width +
- "&q=" +
- quality
- );
+export const imageLoader = ({ src }) => {
+ return imageBaseUrl + src;
};
diff --git a/fixtures/webstudio-custom-template/custom-template/app/constants.mjs b/fixtures/webstudio-custom-template/custom-template/app/constants.mjs
index 86296ca05c..9cf6da7f7e 100644
--- a/fixtures/webstudio-custom-template/custom-template/app/constants.mjs
+++ b/fixtures/webstudio-custom-template/custom-template/app/constants.mjs
@@ -8,18 +8,6 @@ export const imageBaseUrl = "/custom-folder/";
/**
* @type {import("@webstudio-is/image").ImageLoader}
*/
-export const imageLoader = ({ quality, src, width }) => {
- if (process.env.NODE_ENV !== "production") {
- return imageBaseUrl + src;
- }
-
- // https://vercel.com/blog/build-your-own-web-framework#automatic-image-optimization
- return (
- "/_vercel/image?url=" +
- encodeURIComponent(imageBaseUrl + src) +
- "&w=" +
- width +
- "&q=" +
- quality
- );
+export const imageLoader = ({ src }) => {
+ return imageBaseUrl + src;
};
diff --git a/fixtures/webstudio-custom-template/package.json b/fixtures/webstudio-custom-template/package.json
index 1cbbbfb0bc..82df8c24a0 100644
--- a/fixtures/webstudio-custom-template/package.json
+++ b/fixtures/webstudio-custom-template/package.json
@@ -3,8 +3,8 @@
"custom-template-script": "echo \"This is a custom template script\"",
"build": "remix build",
"dev": "remix dev",
- "start": "remix-serve build",
"typecheck": "tsc",
+ "start": "remix-serve build",
"checks": "pnpm typecheck",
"size-test": "rm -rf ./public && remix build && size-limit"
},
@@ -33,7 +33,6 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@webstudio-is/http-client": "workspace:*",
- "eslint": "^8.48.0",
"typescript": "5.2.2",
"webstudio-cli": "workspace:*"
},
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/.webstudio/config.json b/fixtures/webstudio-remix-netlify-edge-functions/.webstudio/config.json
new file mode 100644
index 0000000000..3bad791718
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/.webstudio/config.json
@@ -0,0 +1,3 @@
+{
+ "projectId": "d845c167-ea07-4875-b08d-83e97c09dcce"
+}
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/.webstudio/data.json b/fixtures/webstudio-remix-netlify-edge-functions/.webstudio/data.json
new file mode 100644
index 0000000000..40584d7f66
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/.webstudio/data.json
@@ -0,0 +1,197 @@
+{
+ "build": {
+ "id": "a298339d-fb81-44ef-a688-e5b1221f9532",
+ "projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
+ "version": 18,
+ "createdAt": "2023-09-23T09:29:28.107Z",
+ "pages": {
+ "homePage": {
+ "id": "9di_L14CzctvSruIoKVvE",
+ "name": "Home",
+ "title": "Home",
+ "meta": {},
+ "rootInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "path": ""
+ },
+ "pages": []
+ },
+ "breakpoints": [
+ [
+ "rKj-wYctg3-GnqL3WHN9I",
+ {
+ "id": "rKj-wYctg3-GnqL3WHN9I",
+ "label": "Base"
+ }
+ ],
+ [
+ "yH9RXhqCyeaVkrOt8MzLc",
+ {
+ "id": "yH9RXhqCyeaVkrOt8MzLc",
+ "label": "Tablet",
+ "maxWidth": 991
+ }
+ ],
+ [
+ "8nSCZbeS002IVwkTdoIes",
+ {
+ "id": "8nSCZbeS002IVwkTdoIes",
+ "label": "Mobile landscape",
+ "maxWidth": 767
+ }
+ ],
+ [
+ "7gBD25KrrbBdJYNDlhPz7",
+ {
+ "id": "7gBD25KrrbBdJYNDlhPz7",
+ "label": "Mobile portrait",
+ "maxWidth": 479
+ }
+ ]
+ ],
+ "styles": [
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "display",
+ "value": {
+ "type": "keyword",
+ "value": "flex"
+ }
+ }
+ ],
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "alignItems",
+ "value": {
+ "type": "keyword",
+ "value": "center"
+ }
+ }
+ ],
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "justifyContent",
+ "value": {
+ "type": "keyword",
+ "value": "center"
+ }
+ }
+ ],
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "flexDirection",
+ "value": {
+ "type": "keyword",
+ "value": "column"
+ }
+ }
+ ]
+ ],
+ "styleSources": [
+ [
+ "7_QL45cpvP-zG8Hkgf4cr",
+ {
+ "type": "local",
+ "id": "7_QL45cpvP-zG8Hkgf4cr"
+ }
+ ]
+ ],
+ "styleSourceSelections": [
+ [
+ "MMimeobf_zi4ZkRGXapju",
+ {
+ "instanceId": "MMimeobf_zi4ZkRGXapju",
+ "values": ["7_QL45cpvP-zG8Hkgf4cr"]
+ }
+ ]
+ ],
+ "props": [],
+ "dataSources": [],
+ "instances": [
+ [
+ "MMimeobf_zi4ZkRGXapju",
+ {
+ "type": "instance",
+ "id": "MMimeobf_zi4ZkRGXapju",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "MYDt0guk1-vzc7yzqyN6A"
+ },
+ {
+ "type": "id",
+ "value": "BMJfjOzunWs8XkQgvvx1e"
+ }
+ ]
+ }
+ ],
+ [
+ "MYDt0guk1-vzc7yzqyN6A",
+ {
+ "type": "instance",
+ "id": "MYDt0guk1-vzc7yzqyN6A",
+ "component": "Heading",
+ "children": [
+ {
+ "type": "text",
+ "value": "Simple Project to test CLI"
+ }
+ ]
+ }
+ ],
+ [
+ "BMJfjOzunWs8XkQgvvx1e",
+ {
+ "type": "instance",
+ "id": "BMJfjOzunWs8XkQgvvx1e",
+ "component": "Text",
+ "children": [
+ {
+ "type": "text",
+ "value": "Please don't change directly in the fixture"
+ }
+ ]
+ }
+ ]
+ ],
+ "deployment": {
+ "domains": [],
+ "projectDomain": "cli-basic-test-d0osr"
+ }
+ },
+ "page": {
+ "id": "9di_L14CzctvSruIoKVvE",
+ "name": "Home",
+ "title": "Home",
+ "meta": {},
+ "rootInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "path": ""
+ },
+ "pages": [
+ {
+ "id": "9di_L14CzctvSruIoKVvE",
+ "name": "Home",
+ "title": "Home",
+ "meta": {},
+ "rootInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "path": ""
+ }
+ ],
+ "assets": [],
+ "user": {
+ "email": "[email protected]"
+ },
+ "projectDomain": "cli-basic-test-d0osr"
+}
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
new file mode 100644
index 0000000000..037d57a6c3
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.tsx
@@ -0,0 +1,60 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import { type ReactNode, useState } from "react";
+import type { PageData } from "~/routes/_index";
+import type { Asset } from "@webstudio-is/sdk";
+import {
+ Body as Body,
+ Heading as Heading,
+ Text as Text,
+} from "@webstudio-is/sdk-components-react";
+
+export const fontAssets: Asset[] = [];
+export const pageData: PageData = {
+ build: { props: [] },
+ pages: [
+ {
+ id: "9di_L14CzctvSruIoKVvE",
+ name: "Home",
+ title: "Home",
+ meta: {},
+ rootInstanceId: "MMimeobf_zi4ZkRGXapju",
+ path: "",
+ },
+ ],
+ page: {
+ id: "9di_L14CzctvSruIoKVvE",
+ name: "Home",
+ title: "Home",
+ meta: {},
+ rootInstanceId: "MMimeobf_zi4ZkRGXapju",
+ path: "",
+ },
+ assets: [],
+};
+export const user: { email: string | null } | undefined = {
+ email: "[email protected]",
+};
+export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";
+
+const Page = (props: { scripts?: ReactNode }) => {
+ return (
+ <Body data-ws-id="MMimeobf_zi4ZkRGXapju" data-ws-component="Body">
+ <Heading data-ws-id="MYDt0guk1-vzc7yzqyN6A" data-ws-component="Heading">
+ {"Simple Project to test CLI"}
+ </Heading>
+ <Text data-ws-id="BMJfjOzunWs8XkQgvvx1e" data-ws-component="Text">
+ {"Please don't change directly in the fixture"}
+ </Text>
+ {props.scripts}
+ </Body>
+ );
+};
+
+export { Page };
+
+export const formsProperties = new Map<
+ string,
+ { method?: string; action?: string }
+>([]);
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/index.css b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/index.css
new file mode 100644
index 0000000000..5fb7b76bb1
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/index.css
@@ -0,0 +1,88 @@
+html {
+ margin: 0;
+ display: grid;
+ min-height: 100%;
+}
+@media all {
+ body:where([data-ws-component="Body"]) {
+ margin-top: 0;
+ margin-right: 0;
+ margin-bottom: 0;
+ margin-left: 0;
+ font-family: Arial, Roboto, sans-serif;
+ font-size: 16px;
+ line-height: 1.2;
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+ h1:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h2:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h3:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h4:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h5:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h6:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ div:where([data-ws-component="Text"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ min-height: 1em;
+ }
+}
+@media all {
+ [data-ws-id="MMimeobf_zi4ZkRGXapju"] {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ }
+}
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/constants.mjs b/fixtures/webstudio-remix-netlify-edge-functions/app/constants.mjs
new file mode 100644
index 0000000000..24fd396edf
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/constants.mjs
@@ -0,0 +1,13 @@
+/**
+ * We use mjs extension as constants in this file is shared with the build script
+ * and we use `node --eval` to extract the constants.
+ */
+export const assetBaseUrl = "/assets/";
+export const imageBaseUrl = "/assets/";
+
+/**
+ * @type {import("@webstudio-is/image").ImageLoader}
+ */
+export const imageLoader = ({ src }) => {
+ return imageBaseUrl + src;
+};
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/entry.server.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/entry.server.tsx
new file mode 100644
index 0000000000..fb8ea87098
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/entry.server.tsx
@@ -0,0 +1,21 @@
+import type { EntryContext } from "@remix-run/node";
+import { RemixServer } from "@remix-run/react";
+import { renderToString } from "react-dom/server";
+
+export default function handleRequest(
+ request: Request,
+ responseStatusCode: number,
+ responseHeaders: Headers,
+ remixContext: EntryContext
+) {
+ const markup = renderToString(
+ <RemixServer context={remixContext} url={request.url} />
+ );
+
+ responseHeaders.set("Content-Type", "text/html");
+
+ return new Response("<!DOCTYPE html>" + markup, {
+ headers: responseHeaders,
+ status: responseStatusCode,
+ });
+}
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/root.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/root.tsx
new file mode 100644
index 0000000000..d873875663
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/root.tsx
@@ -0,0 +1 @@
+export { Root as default } from "@webstudio-is/react-sdk";
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
new file mode 100644
index 0000000000..1695eb2578
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx
@@ -0,0 +1,196 @@
+/* eslint-disable camelcase */
+import {
+ type V2_ServerRuntimeMetaFunction,
+ type LinksFunction,
+ type LinkDescriptor,
+ type ActionArgs,
+ json,
+} from "@remix-run/server-runtime";
+import { atom } from "nanostores";
+import { ReactSdkContext, getPropsByInstanceId } from "@webstudio-is/react-sdk";
+import { n8nHandler, getFormId } from "@webstudio-is/form-handlers";
+import { Scripts, ScrollRestoration } from "@remix-run/react";
+import {
+ fontAssets,
+ pageData,
+ user,
+ projectId,
+ formsProperties,
+ Page,
+} from "../__generated__/_index.tsx";
+import css from "../__generated__/index.css";
+import type { Data } from "@webstudio-is/http-client";
+import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
+
+export type PageData = Omit<Data, "build"> & {
+ build: Pick<Data["build"], "props">;
+};
+
+export const meta: V2_ServerRuntimeMetaFunction = () => {
+ const { page } = pageData;
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
+};
+
+export const links: LinksFunction = () => {
+ const result: LinkDescriptor[] = [];
+
+ result.push({
+ rel: "stylesheet",
+ href: css,
+ });
+
+ for (const asset of fontAssets) {
+ if (asset.type === "font") {
+ result.push({
+ rel: "preload",
+ href: assetBaseUrl + asset.name,
+ as: "font",
+ crossOrigin: "anonymous",
+ // @todo add mimeType
+ // type: asset.mimeType,
+ });
+ }
+ }
+
+ return result;
+};
+
+const getRequestHost = (request: Request): string =>
+ request.headers.get("x-forwarded-host") || request.headers.get("host") || "";
+
+const getMethod = (value: string | undefined) => {
+ if (value === undefined) {
+ return "post";
+ }
+
+ switch (value.toLowerCase()) {
+ case "get":
+ return "get";
+ default:
+ return "post";
+ }
+};
+
+export const action = async ({ request, context }: ActionArgs) => {
+ const formData = await request.formData();
+
+ const formId = getFormId(formData);
+ if (formId === undefined) {
+ // We're throwing rather than returning { success: false }
+ // because this isn't supposed to happen normally: bug or malicious user
+ throw json("Form not found", { status: 404 });
+ }
+
+ const formProperties = formsProperties.get(formId);
+
+ // form properties are not defined when defaults are used
+ const { action, method } = formProperties ?? {};
+
+ const email = user?.email;
+
+ if (email == null) {
+ return { success: false };
+ }
+
+ // wrapped in try/catch just in cases new URL() throws
+ // (should not happen)
+ let pageUrl: URL;
+ try {
+ pageUrl = new URL(request.url);
+ pageUrl.host = getRequestHost(request);
+ } catch {
+ return { success: false };
+ }
+
+ if (action !== undefined) {
+ try {
+ // Test that action is full URL
+ new URL(action);
+ } catch {
+ return json(
+ {
+ success: false,
+ error: "Invalid action URL, must be valid http/https protocol",
+ },
+ { status: 200 }
+ );
+ }
+ }
+
+ const formInfo = {
+ formData,
+ projectId,
+ action: action ?? null,
+ method: getMethod(method),
+ pageUrl: pageUrl.toString(),
+ toEmail: email,
+ fromEmail: pageUrl.hostname + "@webstudio.email",
+ } as const;
+
+ const result = await n8nHandler({
+ formInfo,
+ hookUrl: context.N8N_FORM_EMAIL_HOOK as string,
+ });
+
+ return result;
+};
+
+const Outlet = () => {
+ const page = pageData.page;
+
+ if (page === undefined) {
+ throw json("Page not found", {
+ status: 404,
+ });
+ }
+
+ return (
+ <ReactSdkContext.Provider
+ value={{
+ propsByInstanceIdStore: atom(
+ getPropsByInstanceId(new Map(pageData.build.props))
+ ),
+ assetsStore: atom(
+ new Map(pageData.assets.map((asset) => [asset.id, asset]))
+ ),
+ pagesStore: atom(
+ new Map(pageData.pages.map((page) => [page.id, page]))
+ ),
+ dataSourcesLogicStore: atom(new Map()),
+ imageLoader,
+ assetBaseUrl,
+ imageBaseUrl,
+ indexesWithinAncestors: new Map(),
+ }}
+ >
+ <Page
+ scripts={
+ <>
+ <Scripts />
+ <ScrollRestoration />
+ </>
+ }
+ />
+ </ReactSdkContext.Provider>
+ );
+};
+
+export default Outlet;
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/netlify.toml b/fixtures/webstudio-remix-netlify-edge-functions/netlify.toml
new file mode 100644
index 0000000000..13021f65c8
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/netlify.toml
@@ -0,0 +1,7 @@
+[build]
+command = "npm run build"
+publish = "public"
+
+[dev]
+command = "npm run dev"
+targetPort = 3000
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/package.json b/fixtures/webstudio-remix-netlify-edge-functions/package.json
new file mode 100644
index 0000000000..305c930317
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/package.json
@@ -0,0 +1,48 @@
+{
+ "scripts": {
+ "predev": "node -e \"fs.rmSync('./public/_redirects', { recursive: true, force: true })\"",
+ "start": "netlify serve",
+ "build": "remix build",
+ "dev": "remix dev",
+ "typecheck": "tsc"
+ },
+ "dependencies": {
+ "@netlify/functions": "^1.3.0",
+ "@netlify/edge-functions": "^2.0.0",
+ "@netlify/remix-edge-adapter": "1.2.0",
+ "@remix-run/react": "^1.19.2",
+ "@remix-run/server-runtime": "^1.19.2",
+ "@remix-run/node": "^1.19.2",
+ "@webstudio-is/react-sdk": "workspace:*",
+ "@webstudio-is/sdk-components-react-radix": "workspace:*",
+ "@webstudio-is/sdk-components-react-remix": "workspace:*",
+ "@webstudio-is/sdk-components-react": "workspace:*",
+ "@webstudio-is/form-handlers": "workspace:*",
+ "@webstudio-is/image": "workspace:*",
+ "@webstudio-is/sdk": "workspace:*",
+ "isbot": "^3.6.8",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
+ },
+ "private": true,
+ "sideEffects": false,
+ "devDependencies": {
+ "@remix-run/serve": "^1.19.2",
+ "@remix-run/dev": "^1.19.2",
+ "@types/react": "^18.2.20",
+ "@types/react-dom": "^18.2.7",
+ "@webstudio-is/http-client": "workspace:*",
+ "typescript": "5.2.2",
+ "webstudio-cli": "workspace:*"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "name": "webstudio-remix-netlify-edge-functions",
+ "version": "0.0.1",
+ "description": "",
+ "main": "index.js",
+ "keywords": [],
+ "author": "",
+ "license": "AGPL-3.0-or-later"
+}
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/public/favicon.ico b/fixtures/webstudio-remix-netlify-edge-functions/public/favicon.ico
new file mode 100644
index 0000000000..9cb8c815dc
Binary files /dev/null and b/fixtures/webstudio-remix-netlify-edge-functions/public/favicon.ico differ
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/remix.config.js b/fixtures/webstudio-remix-netlify-edge-functions/remix.config.js
new file mode 100644
index 0000000000..229cbb951b
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/remix.config.js
@@ -0,0 +1,29 @@
+const { config } = require("@netlify/remix-edge-adapter");
+const baseConfig =
+ process.env.NODE_ENV === "production"
+ ? config
+ : {
+ ignoredRouteFiles: ["**/.*"],
+ serverModuleFormat: "cjs",
+ serverDependenciesToBundle: [
+ /@webstudio-is\//,
+ "nanoid",
+ "nanostores",
+ "@nanostores/react",
+ "@jsep-plugin/assignment",
+ ],
+ };
+
+/** @type {import('@remix-run/dev').AppConfig} */
+module.exports = {
+ ignoredRouteFiles: ["**/.*"],
+ ...baseConfig,
+ future: {
+ v2_errorBoundary: true,
+ v2_headers: true,
+ v2_meta: true,
+ v2_normalizeFormMethod: true,
+ v2_routeConvention: true,
+ v2_dev: true,
+ },
+};
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts b/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts
new file mode 100644
index 0000000000..dcf8c45e1d
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/remix.env.d.ts
@@ -0,0 +1,2 @@
+/// <reference types="@remix-run/dev" />
+/// <reference types="@remix-run/node" />
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/server.js b/fixtures/webstudio-remix-netlify-edge-functions/server.js
new file mode 100644
index 0000000000..18dc1b517c
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/server.js
@@ -0,0 +1,19 @@
+// Import path interpreted by the Remix compiler
+import * as build from "@remix-run/dev/server-build";
+import { createRequestHandler } from "@netlify/remix-edge-adapter";
+
+export default createRequestHandler({
+ build,
+ // process.env.NODE_ENV is provided by Remix at compile time
+ mode: process.env.NODE_ENV,
+});
+
+export const config = {
+ cache: "manual",
+ path: "/*",
+ // Let the CDN handle requests for static assets, i.e. ^/_assets/*$
+ //
+ // Add other exclusions here, e.g. "^/api/*$" for custom Netlify functions or
+ // custom Netlify Edge Functions
+ excluded_patterns: ["^/_assets/*$"],
+};
diff --git a/fixtures/webstudio-remix-netlify-edge-functions/tsconfig.json b/fixtures/webstudio-remix-netlify-edge-functions/tsconfig.json
new file mode 100644
index 0000000000..c760c76b13
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-edge-functions/tsconfig.json
@@ -0,0 +1,26 @@
+{
+ "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs"],
+ "compilerOptions": {
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
+ "isolatedModules": true,
+ "esModuleInterop": true,
+ "jsx": "react-jsx",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "target": "ES2022",
+ "strict": true,
+ "allowJs": true,
+ "checkJs": true,
+ "forceConsistentCasingInFileNames": true,
+ "allowImportingTsExtensions": true,
+ "baseUrl": ".",
+ "paths": {
+ "~/*": ["./app/*"]
+ },
+ "customConditions": ["webstudio"],
+
+ // Remix takes care of building everything in `remix build`.
+ "noEmit": true,
+ "skipLibCheck": true
+ }
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/.webstudio/config.json b/fixtures/webstudio-remix-netlify-functions/.webstudio/config.json
new file mode 100644
index 0000000000..3bad791718
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/.webstudio/config.json
@@ -0,0 +1,3 @@
+{
+ "projectId": "d845c167-ea07-4875-b08d-83e97c09dcce"
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/.webstudio/data.json b/fixtures/webstudio-remix-netlify-functions/.webstudio/data.json
new file mode 100644
index 0000000000..40584d7f66
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/.webstudio/data.json
@@ -0,0 +1,197 @@
+{
+ "build": {
+ "id": "a298339d-fb81-44ef-a688-e5b1221f9532",
+ "projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
+ "version": 18,
+ "createdAt": "2023-09-23T09:29:28.107Z",
+ "pages": {
+ "homePage": {
+ "id": "9di_L14CzctvSruIoKVvE",
+ "name": "Home",
+ "title": "Home",
+ "meta": {},
+ "rootInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "path": ""
+ },
+ "pages": []
+ },
+ "breakpoints": [
+ [
+ "rKj-wYctg3-GnqL3WHN9I",
+ {
+ "id": "rKj-wYctg3-GnqL3WHN9I",
+ "label": "Base"
+ }
+ ],
+ [
+ "yH9RXhqCyeaVkrOt8MzLc",
+ {
+ "id": "yH9RXhqCyeaVkrOt8MzLc",
+ "label": "Tablet",
+ "maxWidth": 991
+ }
+ ],
+ [
+ "8nSCZbeS002IVwkTdoIes",
+ {
+ "id": "8nSCZbeS002IVwkTdoIes",
+ "label": "Mobile landscape",
+ "maxWidth": 767
+ }
+ ],
+ [
+ "7gBD25KrrbBdJYNDlhPz7",
+ {
+ "id": "7gBD25KrrbBdJYNDlhPz7",
+ "label": "Mobile portrait",
+ "maxWidth": 479
+ }
+ ]
+ ],
+ "styles": [
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:display:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "display",
+ "value": {
+ "type": "keyword",
+ "value": "flex"
+ }
+ }
+ ],
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:alignItems:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "alignItems",
+ "value": {
+ "type": "keyword",
+ "value": "center"
+ }
+ }
+ ],
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:justifyContent:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "justifyContent",
+ "value": {
+ "type": "keyword",
+ "value": "center"
+ }
+ }
+ ],
+ [
+ "7_QL45cpvP-zG8Hkgf4cr:rKj-wYctg3-GnqL3WHN9I:flexDirection:",
+ {
+ "breakpointId": "rKj-wYctg3-GnqL3WHN9I",
+ "styleSourceId": "7_QL45cpvP-zG8Hkgf4cr",
+ "property": "flexDirection",
+ "value": {
+ "type": "keyword",
+ "value": "column"
+ }
+ }
+ ]
+ ],
+ "styleSources": [
+ [
+ "7_QL45cpvP-zG8Hkgf4cr",
+ {
+ "type": "local",
+ "id": "7_QL45cpvP-zG8Hkgf4cr"
+ }
+ ]
+ ],
+ "styleSourceSelections": [
+ [
+ "MMimeobf_zi4ZkRGXapju",
+ {
+ "instanceId": "MMimeobf_zi4ZkRGXapju",
+ "values": ["7_QL45cpvP-zG8Hkgf4cr"]
+ }
+ ]
+ ],
+ "props": [],
+ "dataSources": [],
+ "instances": [
+ [
+ "MMimeobf_zi4ZkRGXapju",
+ {
+ "type": "instance",
+ "id": "MMimeobf_zi4ZkRGXapju",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "MYDt0guk1-vzc7yzqyN6A"
+ },
+ {
+ "type": "id",
+ "value": "BMJfjOzunWs8XkQgvvx1e"
+ }
+ ]
+ }
+ ],
+ [
+ "MYDt0guk1-vzc7yzqyN6A",
+ {
+ "type": "instance",
+ "id": "MYDt0guk1-vzc7yzqyN6A",
+ "component": "Heading",
+ "children": [
+ {
+ "type": "text",
+ "value": "Simple Project to test CLI"
+ }
+ ]
+ }
+ ],
+ [
+ "BMJfjOzunWs8XkQgvvx1e",
+ {
+ "type": "instance",
+ "id": "BMJfjOzunWs8XkQgvvx1e",
+ "component": "Text",
+ "children": [
+ {
+ "type": "text",
+ "value": "Please don't change directly in the fixture"
+ }
+ ]
+ }
+ ]
+ ],
+ "deployment": {
+ "domains": [],
+ "projectDomain": "cli-basic-test-d0osr"
+ }
+ },
+ "page": {
+ "id": "9di_L14CzctvSruIoKVvE",
+ "name": "Home",
+ "title": "Home",
+ "meta": {},
+ "rootInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "path": ""
+ },
+ "pages": [
+ {
+ "id": "9di_L14CzctvSruIoKVvE",
+ "name": "Home",
+ "title": "Home",
+ "meta": {},
+ "rootInstanceId": "MMimeobf_zi4ZkRGXapju",
+ "path": ""
+ }
+ ],
+ "assets": [],
+ "user": {
+ "email": "[email protected]"
+ },
+ "projectDomain": "cli-basic-test-d0osr"
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/_app_redirects b/fixtures/webstudio-remix-netlify-functions/_app_redirects
new file mode 100644
index 0000000000..cf910997da
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/_app_redirects
@@ -0,0 +1,7 @@
+# This template uses this file instead of the typicial Netlify _redirects file.
+# For more information about redirects and rewrites, see https://docs.netlify.com/routing/redirects/.
+
+# Do not remove the line below. This is required to serve the site when deployed.
+/* /.netlify/functions/server 200
+
+# Add other redirects and rewrites here and/or in your netlify.toml
diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
new file mode 100644
index 0000000000..037d57a6c3
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.tsx
@@ -0,0 +1,60 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import { type ReactNode, useState } from "react";
+import type { PageData } from "~/routes/_index";
+import type { Asset } from "@webstudio-is/sdk";
+import {
+ Body as Body,
+ Heading as Heading,
+ Text as Text,
+} from "@webstudio-is/sdk-components-react";
+
+export const fontAssets: Asset[] = [];
+export const pageData: PageData = {
+ build: { props: [] },
+ pages: [
+ {
+ id: "9di_L14CzctvSruIoKVvE",
+ name: "Home",
+ title: "Home",
+ meta: {},
+ rootInstanceId: "MMimeobf_zi4ZkRGXapju",
+ path: "",
+ },
+ ],
+ page: {
+ id: "9di_L14CzctvSruIoKVvE",
+ name: "Home",
+ title: "Home",
+ meta: {},
+ rootInstanceId: "MMimeobf_zi4ZkRGXapju",
+ path: "",
+ },
+ assets: [],
+};
+export const user: { email: string | null } | undefined = {
+ email: "[email protected]",
+};
+export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";
+
+const Page = (props: { scripts?: ReactNode }) => {
+ return (
+ <Body data-ws-id="MMimeobf_zi4ZkRGXapju" data-ws-component="Body">
+ <Heading data-ws-id="MYDt0guk1-vzc7yzqyN6A" data-ws-component="Heading">
+ {"Simple Project to test CLI"}
+ </Heading>
+ <Text data-ws-id="BMJfjOzunWs8XkQgvvx1e" data-ws-component="Text">
+ {"Please don't change directly in the fixture"}
+ </Text>
+ {props.scripts}
+ </Body>
+ );
+};
+
+export { Page };
+
+export const formsProperties = new Map<
+ string,
+ { method?: string; action?: string }
+>([]);
diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/index.css b/fixtures/webstudio-remix-netlify-functions/app/__generated__/index.css
new file mode 100644
index 0000000000..5fb7b76bb1
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/index.css
@@ -0,0 +1,88 @@
+html {
+ margin: 0;
+ display: grid;
+ min-height: 100%;
+}
+@media all {
+ body:where([data-ws-component="Body"]) {
+ margin-top: 0;
+ margin-right: 0;
+ margin-bottom: 0;
+ margin-left: 0;
+ font-family: Arial, Roboto, sans-serif;
+ font-size: 16px;
+ line-height: 1.2;
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+ h1:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h2:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h3:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h4:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h5:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ h6:where([data-ws-component="Heading"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ }
+ div:where([data-ws-component="Text"]) {
+ box-sizing: border-box;
+ border-top-width: 1px;
+ border-right-width: 1px;
+ border-bottom-width: 1px;
+ border-left-width: 1px;
+ outline-width: 1px;
+ min-height: 1em;
+ }
+}
+@media all {
+ [data-ws-id="MMimeobf_zi4ZkRGXapju"] {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ }
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/app/constants.mjs b/fixtures/webstudio-remix-netlify-functions/app/constants.mjs
new file mode 100644
index 0000000000..24fd396edf
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/app/constants.mjs
@@ -0,0 +1,13 @@
+/**
+ * We use mjs extension as constants in this file is shared with the build script
+ * and we use `node --eval` to extract the constants.
+ */
+export const assetBaseUrl = "/assets/";
+export const imageBaseUrl = "/assets/";
+
+/**
+ * @type {import("@webstudio-is/image").ImageLoader}
+ */
+export const imageLoader = ({ src }) => {
+ return imageBaseUrl + src;
+};
diff --git a/fixtures/webstudio-remix-netlify-functions/app/entry.server.tsx b/fixtures/webstudio-remix-netlify-functions/app/entry.server.tsx
new file mode 100644
index 0000000000..fb8ea87098
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/app/entry.server.tsx
@@ -0,0 +1,21 @@
+import type { EntryContext } from "@remix-run/node";
+import { RemixServer } from "@remix-run/react";
+import { renderToString } from "react-dom/server";
+
+export default function handleRequest(
+ request: Request,
+ responseStatusCode: number,
+ responseHeaders: Headers,
+ remixContext: EntryContext
+) {
+ const markup = renderToString(
+ <RemixServer context={remixContext} url={request.url} />
+ );
+
+ responseHeaders.set("Content-Type", "text/html");
+
+ return new Response("<!DOCTYPE html>" + markup, {
+ headers: responseHeaders,
+ status: responseStatusCode,
+ });
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/app/root.tsx b/fixtures/webstudio-remix-netlify-functions/app/root.tsx
new file mode 100644
index 0000000000..d873875663
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/app/root.tsx
@@ -0,0 +1 @@
+export { Root as default } from "@webstudio-is/react-sdk";
diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
new file mode 100644
index 0000000000..1695eb2578
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx
@@ -0,0 +1,196 @@
+/* eslint-disable camelcase */
+import {
+ type V2_ServerRuntimeMetaFunction,
+ type LinksFunction,
+ type LinkDescriptor,
+ type ActionArgs,
+ json,
+} from "@remix-run/server-runtime";
+import { atom } from "nanostores";
+import { ReactSdkContext, getPropsByInstanceId } from "@webstudio-is/react-sdk";
+import { n8nHandler, getFormId } from "@webstudio-is/form-handlers";
+import { Scripts, ScrollRestoration } from "@remix-run/react";
+import {
+ fontAssets,
+ pageData,
+ user,
+ projectId,
+ formsProperties,
+ Page,
+} from "../__generated__/_index.tsx";
+import css from "../__generated__/index.css";
+import type { Data } from "@webstudio-is/http-client";
+import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
+
+export type PageData = Omit<Data, "build"> & {
+ build: Pick<Data["build"], "props">;
+};
+
+export const meta: V2_ServerRuntimeMetaFunction = () => {
+ const { page } = pageData;
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
+};
+
+export const links: LinksFunction = () => {
+ const result: LinkDescriptor[] = [];
+
+ result.push({
+ rel: "stylesheet",
+ href: css,
+ });
+
+ for (const asset of fontAssets) {
+ if (asset.type === "font") {
+ result.push({
+ rel: "preload",
+ href: assetBaseUrl + asset.name,
+ as: "font",
+ crossOrigin: "anonymous",
+ // @todo add mimeType
+ // type: asset.mimeType,
+ });
+ }
+ }
+
+ return result;
+};
+
+const getRequestHost = (request: Request): string =>
+ request.headers.get("x-forwarded-host") || request.headers.get("host") || "";
+
+const getMethod = (value: string | undefined) => {
+ if (value === undefined) {
+ return "post";
+ }
+
+ switch (value.toLowerCase()) {
+ case "get":
+ return "get";
+ default:
+ return "post";
+ }
+};
+
+export const action = async ({ request, context }: ActionArgs) => {
+ const formData = await request.formData();
+
+ const formId = getFormId(formData);
+ if (formId === undefined) {
+ // We're throwing rather than returning { success: false }
+ // because this isn't supposed to happen normally: bug or malicious user
+ throw json("Form not found", { status: 404 });
+ }
+
+ const formProperties = formsProperties.get(formId);
+
+ // form properties are not defined when defaults are used
+ const { action, method } = formProperties ?? {};
+
+ const email = user?.email;
+
+ if (email == null) {
+ return { success: false };
+ }
+
+ // wrapped in try/catch just in cases new URL() throws
+ // (should not happen)
+ let pageUrl: URL;
+ try {
+ pageUrl = new URL(request.url);
+ pageUrl.host = getRequestHost(request);
+ } catch {
+ return { success: false };
+ }
+
+ if (action !== undefined) {
+ try {
+ // Test that action is full URL
+ new URL(action);
+ } catch {
+ return json(
+ {
+ success: false,
+ error: "Invalid action URL, must be valid http/https protocol",
+ },
+ { status: 200 }
+ );
+ }
+ }
+
+ const formInfo = {
+ formData,
+ projectId,
+ action: action ?? null,
+ method: getMethod(method),
+ pageUrl: pageUrl.toString(),
+ toEmail: email,
+ fromEmail: pageUrl.hostname + "@webstudio.email",
+ } as const;
+
+ const result = await n8nHandler({
+ formInfo,
+ hookUrl: context.N8N_FORM_EMAIL_HOOK as string,
+ });
+
+ return result;
+};
+
+const Outlet = () => {
+ const page = pageData.page;
+
+ if (page === undefined) {
+ throw json("Page not found", {
+ status: 404,
+ });
+ }
+
+ return (
+ <ReactSdkContext.Provider
+ value={{
+ propsByInstanceIdStore: atom(
+ getPropsByInstanceId(new Map(pageData.build.props))
+ ),
+ assetsStore: atom(
+ new Map(pageData.assets.map((asset) => [asset.id, asset]))
+ ),
+ pagesStore: atom(
+ new Map(pageData.pages.map((page) => [page.id, page]))
+ ),
+ dataSourcesLogicStore: atom(new Map()),
+ imageLoader,
+ assetBaseUrl,
+ imageBaseUrl,
+ indexesWithinAncestors: new Map(),
+ }}
+ >
+ <Page
+ scripts={
+ <>
+ <Scripts />
+ <ScrollRestoration />
+ </>
+ }
+ />
+ </ReactSdkContext.Provider>
+ );
+};
+
+export default Outlet;
diff --git a/fixtures/webstudio-remix-netlify-functions/netlify.toml b/fixtures/webstudio-remix-netlify-functions/netlify.toml
new file mode 100644
index 0000000000..630bab84d0
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/netlify.toml
@@ -0,0 +1,14 @@
+[build]
+command = "remix build && cp _app_redirects public/_redirects"
+publish = "public"
+
+[dev]
+command = "npm run dev"
+targetPort = 3000
+
+[[headers]]
+for = "/build/*"
+
+[headers.values]
+# Set to 60 seconds as an example. You can also add cache headers via Remix. See the documentation on [headers](https://remix.run/docs/en/v1/route/headers) in Remix.
+"Cache-Control" = "public, max-age=60, s-maxage=60"
diff --git a/fixtures/webstudio-remix-netlify-functions/package.json b/fixtures/webstudio-remix-netlify-functions/package.json
new file mode 100644
index 0000000000..2929dc3a7c
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/package.json
@@ -0,0 +1,47 @@
+{
+ "scripts": {
+ "predev": "node -e \"fs.rmSync('./public/_redirects', { recursive: true, force: true })\"",
+ "start": "netlify serve",
+ "build": "remix build",
+ "dev": "remix dev",
+ "typecheck": "tsc"
+ },
+ "dependencies": {
+ "@netlify/functions": "^1.3.0",
+ "@netlify/remix-adapter": "^1.0.0",
+ "@remix-run/react": "^1.19.2",
+ "@remix-run/server-runtime": "^1.19.2",
+ "@remix-run/node": "^1.19.2",
+ "@webstudio-is/react-sdk": "workspace:*",
+ "@webstudio-is/sdk-components-react-radix": "workspace:*",
+ "@webstudio-is/sdk-components-react-remix": "workspace:*",
+ "@webstudio-is/sdk-components-react": "workspace:*",
+ "@webstudio-is/form-handlers": "workspace:*",
+ "@webstudio-is/image": "workspace:*",
+ "@webstudio-is/sdk": "workspace:*",
+ "isbot": "^3.6.8",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
+ },
+ "private": true,
+ "sideEffects": false,
+ "devDependencies": {
+ "@remix-run/serve": "^1.19.2",
+ "@remix-run/dev": "^1.19.2",
+ "@types/react": "^18.2.20",
+ "@types/react-dom": "^18.2.7",
+ "@webstudio-is/http-client": "workspace:*",
+ "typescript": "5.2.2",
+ "webstudio-cli": "workspace:*"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "name": "webstudio-remix-netlify-functions",
+ "version": "0.0.1",
+ "description": "",
+ "main": "index.js",
+ "keywords": [],
+ "author": "",
+ "license": "AGPL-3.0-or-later"
+}
diff --git a/fixtures/webstudio-remix-netlify-functions/public/favicon.ico b/fixtures/webstudio-remix-netlify-functions/public/favicon.ico
new file mode 100644
index 0000000000..9cb8c815dc
Binary files /dev/null and b/fixtures/webstudio-remix-netlify-functions/public/favicon.ico differ
diff --git a/fixtures/webstudio-remix-netlify-functions/remix.config.js b/fixtures/webstudio-remix-netlify-functions/remix.config.js
new file mode 100644
index 0000000000..7638e31da8
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/remix.config.js
@@ -0,0 +1,31 @@
+const baseConfig =
+ process.env.NODE_ENV === "production"
+ ? // when running the Netify CLI or building on Netlify, we want to use
+ {
+ server: "./server.js",
+ serverBuildPath: ".netlify/functions-internal/server.js",
+ }
+ : // otherwise support running remix dev, i.e. no custom server
+ undefined;
+
+/** @type {import('@remix-run/dev').AppConfig} */
+module.exports = {
+ ...baseConfig,
+ ignoredRouteFiles: ["**/.*"],
+ serverModuleFormat: "cjs",
+ serverDependenciesToBundle: [
+ /@webstudio-is\//,
+ "nanoid",
+ "nanostores",
+ "@nanostores/react",
+ "@jsep-plugin/assignment",
+ ],
+ future: {
+ v2_errorBoundary: true,
+ v2_headers: true,
+ v2_meta: true,
+ v2_normalizeFormMethod: true,
+ v2_routeConvention: true,
+ v2_dev: true,
+ },
+};
diff --git a/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts b/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts
new file mode 100644
index 0000000000..dcf8c45e1d
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/remix.env.d.ts
@@ -0,0 +1,2 @@
+/// <reference types="@remix-run/dev" />
+/// <reference types="@remix-run/node" />
diff --git a/fixtures/webstudio-remix-netlify-functions/server.js b/fixtures/webstudio-remix-netlify-functions/server.js
new file mode 100644
index 0000000000..6997ce381f
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/server.js
@@ -0,0 +1,7 @@
+import { createRequestHandler } from "@netlify/remix-adapter";
+import * as build from "@remix-run/dev/server-build";
+
+export const handler = createRequestHandler({
+ build,
+ mode: process.env.NODE_ENV,
+});
diff --git a/fixtures/webstudio-remix-netlify-functions/tsconfig.json b/fixtures/webstudio-remix-netlify-functions/tsconfig.json
new file mode 100644
index 0000000000..c760c76b13
--- /dev/null
+++ b/fixtures/webstudio-remix-netlify-functions/tsconfig.json
@@ -0,0 +1,26 @@
+{
+ "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs"],
+ "compilerOptions": {
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
+ "isolatedModules": true,
+ "esModuleInterop": true,
+ "jsx": "react-jsx",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "target": "ES2022",
+ "strict": true,
+ "allowJs": true,
+ "checkJs": true,
+ "forceConsistentCasingInFileNames": true,
+ "allowImportingTsExtensions": true,
+ "baseUrl": ".",
+ "paths": {
+ "~/*": ["./app/*"]
+ },
+ "customConditions": ["webstudio"],
+
+ // Remix takes care of building everything in `remix build`.
+ "noEmit": true,
+ "skipLibCheck": true
+ }
+}
diff --git a/fixtures/webstudio-remix-vercel/.webstudio/data.json b/fixtures/webstudio-remix-vercel/.webstudio/data.json
index af44bfaaf7..8675f9efbc 100644
--- a/fixtures/webstudio-remix-vercel/.webstudio/data.json
+++ b/fixtures/webstudio-remix-vercel/.webstudio/data.json
@@ -1,9 +1,9 @@
{
"build": {
- "id": "9d1c997b-3fcf-4ca6-b467-3814b38669df",
+ "id": "edd62b7a-c819-42ea-920a-ded682f70ac2",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
- "version": 153,
- "createdAt": "2023-09-22T08:56:41.573Z",
+ "version": 177,
+ "createdAt": "2023-09-22T17:58:05.654Z",
"pages": {
"homePage": {
"id": "7Db64ZXgYiRqKSQNR-qTQ",
@@ -43,6 +43,16 @@
},
"rootInstanceId": "a-4nDFkaWy4px1fn38XWJ",
"path": "/form"
+ },
+ {
+ "id": "-J9I4Oo6mONfQlf_3-OqG",
+ "name": "heading-with-id",
+ "title": "heading-with-id",
+ "meta": {
+ "description": ""
+ },
+ "rootInstanceId": "O-ljaGZQ0iRNTlEshMkgE",
+ "path": "/heading-with-id"
}
]
},
@@ -1339,6 +1349,30 @@
"value": 1
}
}
+ ],
+ [
+ "USUcfFPW4YwsvbvNORkpm:UoTkWyaFuTYJihS3MFYK5:display:",
+ {
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
+ "styleSourceId": "USUcfFPW4YwsvbvNORkpm",
+ "property": "display",
+ "value": {
+ "type": "keyword",
+ "value": "block"
+ }
+ }
+ ],
+ [
+ "y8DFYnVCeQ_smp3u6CSTn:UoTkWyaFuTYJihS3MFYK5:display:",
+ {
+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",
+ "styleSourceId": "y8DFYnVCeQ_smp3u6CSTn",
+ "property": "display",
+ "value": {
+ "type": "keyword",
+ "value": "block"
+ }
+ }
]
],
"styleSources": [
@@ -1495,6 +1529,20 @@
"type": "local",
"id": "49DYl_wcHv6juFsJK5Qv3"
}
+ ],
+ [
+ "USUcfFPW4YwsvbvNORkpm",
+ {
+ "type": "local",
+ "id": "USUcfFPW4YwsvbvNORkpm"
+ }
+ ],
+ [
+ "y8DFYnVCeQ_smp3u6CSTn",
+ {
+ "type": "local",
+ "id": "y8DFYnVCeQ_smp3u6CSTn"
+ }
]
],
"styleSourceSelections": [
@@ -1651,6 +1699,20 @@
"instanceId": "AdXSAYCx4QDo5QN6nLoGs",
"values": ["49DYl_wcHv6juFsJK5Qv3"]
}
+ ],
+ [
+ "9I4GRU1sev48hREkQcKQ-",
+ {
+ "instanceId": "9I4GRU1sev48hREkQcKQ-",
+ "values": ["USUcfFPW4YwsvbvNORkpm"]
+ }
+ ],
+ [
+ "81ejLVXyFEV1SxiJrWhyw",
+ {
+ "instanceId": "81ejLVXyFEV1SxiJrWhyw",
+ "values": ["y8DFYnVCeQ_smp3u6CSTn"]
+ }
]
],
"props": [
@@ -1971,6 +2033,29 @@
"type": "asset",
"value": "9a8bc926-7804-4d3f-af81-69196b1d2ed8"
}
+ ],
+ [
+ "bCTT4ssGpfxQfmKk3mONc",
+ {
+ "id": "bCTT4ssGpfxQfmKk3mONc",
+ "instanceId": "qmxnOlSxUGpuhuonVArWJ",
+ "name": "id",
+ "type": "string",
+ "value": "my-heading"
+ }
+ ],
+ [
+ "z8GMy7HFi_j_felIKxGP5",
+ {
+ "id": "z8GMy7HFi_j_felIKxGP5",
+ "instanceId": "81ejLVXyFEV1SxiJrWhyw",
+ "name": "href",
+ "type": "page",
+ "value": {
+ "pageId": "-J9I4Oo6mONfQlf_3-OqG",
+ "instanceId": "qmxnOlSxUGpuhuonVArWJ"
+ }
+ }
]
],
"dataSources": [
@@ -2159,6 +2244,10 @@
{
"type": "id",
"value": "9I4GRU1sev48hREkQcKQ-"
+ },
+ {
+ "type": "id",
+ "value": "81ejLVXyFEV1SxiJrWhyw"
}
]
}
@@ -2989,6 +3078,48 @@
}
]
}
+ ],
+ [
+ "O-ljaGZQ0iRNTlEshMkgE",
+ {
+ "type": "instance",
+ "id": "O-ljaGZQ0iRNTlEshMkgE",
+ "component": "Body",
+ "children": [
+ {
+ "type": "id",
+ "value": "qmxnOlSxUGpuhuonVArWJ"
+ }
+ ]
+ }
+ ],
+ [
+ "qmxnOlSxUGpuhuonVArWJ",
+ {
+ "type": "instance",
+ "id": "qmxnOlSxUGpuhuonVArWJ",
+ "component": "Heading",
+ "children": [
+ {
+ "type": "text",
+ "value": "Heading you can edit"
+ }
+ ]
+ }
+ ],
+ [
+ "81ejLVXyFEV1SxiJrWhyw",
+ {
+ "type": "instance",
+ "id": "81ejLVXyFEV1SxiJrWhyw",
+ "component": "Link",
+ "children": [
+ {
+ "type": "text",
+ "value": "Link to instance"
+ }
+ ]
+ }
]
],
"deployment": {
@@ -3042,6 +3173,16 @@
},
"rootInstanceId": "a-4nDFkaWy4px1fn38XWJ",
"path": "/form"
+ },
+ {
+ "id": "-J9I4Oo6mONfQlf_3-OqG",
+ "name": "heading-with-id",
+ "title": "heading-with-id",
+ "meta": {
+ "description": ""
+ },
+ "rootInstanceId": "O-ljaGZQ0iRNTlEshMkgE",
+ "path": "/heading-with-id"
}
],
"assets": [
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 4fcba9c90f..2409e363c4 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
@@ -58,6 +58,14 @@ export const pageData: PageData = {
rootInstanceId: "a-4nDFkaWy4px1fn38XWJ",
path: "/form",
},
+ {
+ id: "-J9I4Oo6mONfQlf_3-OqG",
+ name: "heading-with-id",
+ title: "heading-with-id",
+ meta: { description: "" },
+ rootInstanceId: "O-ljaGZQ0iRNTlEshMkgE",
+ path: "/heading-with-id",
+ },
],
page: {
id: "szYLvBduHPmbtqQKCDY0b",
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
index 0db48613ca..3cddf3ff14 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.tsx
@@ -245,6 +245,14 @@ export const pageData: PageData = {
rootInstanceId: "a-4nDFkaWy4px1fn38XWJ",
path: "/form",
},
+ {
+ id: "-J9I4Oo6mONfQlf_3-OqG",
+ name: "heading-with-id",
+ title: "heading-with-id",
+ meta: { description: "" },
+ rootInstanceId: "O-ljaGZQ0iRNTlEshMkgE",
+ path: "/heading-with-id",
+ },
],
page: {
id: "U1tRJl2ERr8_OFe0g9cN_",
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
new file mode 100644
index 0000000000..f0be73ba3c
--- /dev/null
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.tsx
@@ -0,0 +1,128 @@
+/* eslint-disable */
+/* This is a auto generated file for building the project */
+
+import { type ReactNode, useState } from "react";
+import type { PageData } from "~/routes/_index";
+import type { Asset } from "@webstudio-is/sdk";
+import {
+ Body as Body,
+ Heading as Heading,
+} from "@webstudio-is/sdk-components-react";
+
+export const fontAssets: Asset[] = [];
+export const pageData: PageData = {
+ build: {
+ props: [
+ [
+ "bCTT4ssGpfxQfmKk3mONc",
+ {
+ id: "bCTT4ssGpfxQfmKk3mONc",
+ instanceId: "qmxnOlSxUGpuhuonVArWJ",
+ name: "id",
+ type: "string",
+ value: "my-heading",
+ },
+ ],
+ ],
+ },
+ pages: [
+ {
+ id: "7Db64ZXgYiRqKSQNR-qTQ",
+ name: "Home",
+ title: "Home",
+ meta: {},
+ rootInstanceId: "On9cvWCxr5rdZtY9O1Bv0",
+ path: "",
+ },
+ {
+ id: "xfvB4UThQXmQ_OubPYrkg",
+ name: "radix",
+ title: "radix",
+ meta: { description: "" },
+ rootInstanceId: "uKWGyE9JY3cPwY-xI9vk6",
+ path: "/radix",
+ },
+ {
+ id: "szYLvBduHPmbtqQKCDY0b",
+ name: "RouteWithSymbols",
+ title: "RouteWithSymbols",
+ meta: { description: "" },
+ rootInstanceId: "EDEfpMPRqDejthtwkH7ws",
+ path: "/_route_with_symbols_",
+ },
+ {
+ id: "U1tRJl2ERr8_OFe0g9cN_",
+ name: "form",
+ title: "form",
+ meta: { description: "" },
+ rootInstanceId: "a-4nDFkaWy4px1fn38XWJ",
+ path: "/form",
+ },
+ {
+ id: "-J9I4Oo6mONfQlf_3-OqG",
+ name: "heading-with-id",
+ title: "heading-with-id",
+ meta: { description: "" },
+ rootInstanceId: "O-ljaGZQ0iRNTlEshMkgE",
+ path: "/heading-with-id",
+ },
+ ],
+ page: {
+ id: "-J9I4Oo6mONfQlf_3-OqG",
+ name: "heading-with-id",
+ title: "heading-with-id",
+ meta: { description: "" },
+ rootInstanceId: "O-ljaGZQ0iRNTlEshMkgE",
+ path: "/heading-with-id",
+ },
+ assets: [
+ {
+ id: "9a8bc926-7804-4d3f-af81-69196b1d2ed8",
+ name: "small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp",
+ description: null,
+ projectId: "cddc1d44-af37-4cb6-a430-d300cf6f932d",
+ size: 2906,
+ type: "image",
+ format: "webp",
+ createdAt: "2023-09-12T09:44:22.120Z",
+ meta: { width: 100, height: 100 },
+ },
+ {
+ id: "cd939c56-bcdd-4e64-bd9c-567a9bccd3da",
+ name: "_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg",
+ description: null,
+ projectId: "cddc1d44-af37-4cb6-a430-d300cf6f932d",
+ size: 210614,
+ type: "image",
+ format: "jpeg",
+ createdAt: "2023-09-06T11:28:43.031Z",
+ meta: { width: 1024, height: 1024 },
+ },
+ ],
+};
+export const user: { email: string | null } | undefined = {
+ email: "[email protected]",
+};
+export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";
+
+const Page = (props: { scripts?: ReactNode }) => {
+ return (
+ <Body data-ws-id="O-ljaGZQ0iRNTlEshMkgE" data-ws-component="Body">
+ <Heading
+ data-ws-id="qmxnOlSxUGpuhuonVArWJ"
+ data-ws-component="Heading"
+ id={"my-heading"}
+ >
+ {"Heading you can edit"}
+ </Heading>
+ {props.scripts}
+ </Body>
+ );
+};
+
+export { Page };
+
+export const formsProperties = new Map<
+ string,
+ { method?: string; action?: string }
+>([]);
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
index 7e865a5bd3..32385b4313 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx
@@ -126,6 +126,14 @@ export const pageData: PageData = {
rootInstanceId: "a-4nDFkaWy4px1fn38XWJ",
path: "/form",
},
+ {
+ id: "-J9I4Oo6mONfQlf_3-OqG",
+ name: "heading-with-id",
+ title: "heading-with-id",
+ meta: { description: "" },
+ rootInstanceId: "O-ljaGZQ0iRNTlEshMkgE",
+ path: "/heading-with-id",
+ },
],
page: {
id: "xfvB4UThQXmQ_OubPYrkg",
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
index 3c170a2c4f..e4ee05fac3 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx
@@ -69,6 +69,19 @@ export const pageData: PageData = {
value: "/assets/small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp",
},
],
+ [
+ "z8GMy7HFi_j_felIKxGP5",
+ {
+ id: "z8GMy7HFi_j_felIKxGP5",
+ instanceId: "81ejLVXyFEV1SxiJrWhyw",
+ name: "href",
+ type: "page",
+ value: {
+ pageId: "-J9I4Oo6mONfQlf_3-OqG",
+ instanceId: "qmxnOlSxUGpuhuonVArWJ",
+ },
+ },
+ ],
],
},
pages: [
@@ -104,6 +117,14 @@ export const pageData: PageData = {
rootInstanceId: "a-4nDFkaWy4px1fn38XWJ",
path: "/form",
},
+ {
+ id: "-J9I4Oo6mONfQlf_3-OqG",
+ name: "heading-with-id",
+ title: "heading-with-id",
+ meta: { description: "" },
+ rootInstanceId: "O-ljaGZQ0iRNTlEshMkgE",
+ path: "/heading-with-id",
+ },
],
page: {
id: "7Db64ZXgYiRqKSQNR-qTQ",
@@ -190,6 +211,9 @@ const Page = (props: { scripts?: ReactNode }) => {
<Link data-ws-id="9I4GRU1sev48hREkQcKQ-" data-ws-component="Link">
{"Symbols in path"}
</Link>
+ <Link data-ws-id="81ejLVXyFEV1SxiJrWhyw" data-ws-component="Link">
+ {"Link to instance"}
+ </Link>
</Box>
<Box data-ws-id="qPnkiFGDj8dITWb1kmpGl" data-ws-component="Box">
<Image
diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/index.css b/fixtures/webstudio-remix-vercel/app/__generated__/index.css
index c59c01712c..07681f5fed 100644
--- a/fixtures/webstudio-remix-vercel/app/__generated__/index.css
+++ b/fixtures/webstudio-remix-vercel/app/__generated__/index.css
@@ -463,4 +463,10 @@ html {
[data-ws-id="AdXSAYCx4QDo5QN6nLoGs"] {
aspect-ratio: 1;
}
+ [data-ws-id="9I4GRU1sev48hREkQcKQ-"] {
+ display: block;
+ }
+ [data-ws-id="81ejLVXyFEV1SxiJrWhyw"] {
+ display: block;
+ }
}
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
new file mode 100644
index 0000000000..db84600e37
--- /dev/null
+++ b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx
@@ -0,0 +1,196 @@
+/* eslint-disable camelcase */
+import {
+ type V2_ServerRuntimeMetaFunction,
+ type LinksFunction,
+ type LinkDescriptor,
+ type ActionArgs,
+ json,
+} from "@remix-run/server-runtime";
+import { atom } from "nanostores";
+import { ReactSdkContext, getPropsByInstanceId } from "@webstudio-is/react-sdk";
+import { n8nHandler, getFormId } from "@webstudio-is/form-handlers";
+import { Scripts, ScrollRestoration } from "@remix-run/react";
+import {
+ fontAssets,
+ pageData,
+ user,
+ projectId,
+ formsProperties,
+ Page,
+} from "../__generated__/[heading-with-id]._index.tsx";
+import css from "../__generated__/index.css";
+import type { Data } from "@webstudio-is/http-client";
+import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
+
+export type PageData = Omit<Data, "build"> & {
+ build: Pick<Data["build"], "props">;
+};
+
+export const meta: V2_ServerRuntimeMetaFunction = () => {
+ const { page } = pageData;
+ const metas: ReturnType<V2_ServerRuntimeMetaFunction> = [
+ { title: page?.title || "Webstudio" },
+ ];
+ for (const [name, value] of Object.entries(page?.meta ?? {})) {
+ if (name.startsWith("og:")) {
+ metas.push({
+ property: name,
+ content: value,
+ });
+ continue;
+ }
+
+ metas.push({
+ name,
+ content: value,
+ });
+ }
+
+ return metas;
+};
+
+export const links: LinksFunction = () => {
+ const result: LinkDescriptor[] = [];
+
+ result.push({
+ rel: "stylesheet",
+ href: css,
+ });
+
+ for (const asset of fontAssets) {
+ if (asset.type === "font") {
+ result.push({
+ rel: "preload",
+ href: assetBaseUrl + asset.name,
+ as: "font",
+ crossOrigin: "anonymous",
+ // @todo add mimeType
+ // type: asset.mimeType,
+ });
+ }
+ }
+
+ return result;
+};
+
+const getRequestHost = (request: Request): string =>
+ request.headers.get("x-forwarded-host") || request.headers.get("host") || "";
+
+const getMethod = (value: string | undefined) => {
+ if (value === undefined) {
+ return "post";
+ }
+
+ switch (value.toLowerCase()) {
+ case "get":
+ return "get";
+ default:
+ return "post";
+ }
+};
+
+export const action = async ({ request, context }: ActionArgs) => {
+ const formData = await request.formData();
+
+ const formId = getFormId(formData);
+ if (formId === undefined) {
+ // We're throwing rather than returning { success: false }
+ // because this isn't supposed to happen normally: bug or malicious user
+ throw json("Form not found", { status: 404 });
+ }
+
+ const formProperties = formsProperties.get(formId);
+
+ // form properties are not defined when defaults are used
+ const { action, method } = formProperties ?? {};
+
+ const email = user?.email;
+
+ if (email == null) {
+ return { success: false };
+ }
+
+ // wrapped in try/catch just in cases new URL() throws
+ // (should not happen)
+ let pageUrl: URL;
+ try {
+ pageUrl = new URL(request.url);
+ pageUrl.host = getRequestHost(request);
+ } catch {
+ return { success: false };
+ }
+
+ if (action !== undefined) {
+ try {
+ // Test that action is full URL
+ new URL(action);
+ } catch {
+ return json(
+ {
+ success: false,
+ error: "Invalid action URL, must be valid http/https protocol",
+ },
+ { status: 200 }
+ );
+ }
+ }
+
+ const formInfo = {
+ formData,
+ projectId,
+ action: action ?? null,
+ method: getMethod(method),
+ pageUrl: pageUrl.toString(),
+ toEmail: email,
+ fromEmail: pageUrl.hostname + "@webstudio.email",
+ } as const;
+
+ const result = await n8nHandler({
+ formInfo,
+ hookUrl: context.N8N_FORM_EMAIL_HOOK as string,
+ });
+
+ return result;
+};
+
+const Outlet = () => {
+ const page = pageData.page;
+
+ if (page === undefined) {
+ throw json("Page not found", {
+ status: 404,
+ });
+ }
+
+ return (
+ <ReactSdkContext.Provider
+ value={{
+ propsByInstanceIdStore: atom(
+ getPropsByInstanceId(new Map(pageData.build.props))
+ ),
+ assetsStore: atom(
+ new Map(pageData.assets.map((asset) => [asset.id, asset]))
+ ),
+ pagesStore: atom(
+ new Map(pageData.pages.map((page) => [page.id, page]))
+ ),
+ dataSourcesLogicStore: atom(new Map()),
+ imageLoader,
+ assetBaseUrl,
+ imageBaseUrl,
+ indexesWithinAncestors: new Map(),
+ }}
+ >
+ <Page
+ scripts={
+ <>
+ <Scripts />
+ <ScrollRestoration />
+ </>
+ }
+ />
+ </ReactSdkContext.Provider>
+ );
+};
+
+export default Outlet;
diff --git a/fixtures/webstudio-remix-vercel/package.json b/fixtures/webstudio-remix-vercel/package.json
index d747a1c29a..aec6bf9591 100644
--- a/fixtures/webstudio-remix-vercel/package.json
+++ b/fixtures/webstudio-remix-vercel/package.json
@@ -1,13 +1,12 @@
{
- "private": true,
- "sideEffects": false,
"scripts": {
+ "start": "remix-serve build",
"build": "remix build",
"dev": "remix dev",
- "start": "remix-serve build",
- "typecheck": "tsc",
- "checks": "pnpm typecheck"
+ "typecheck": "tsc"
},
+ "private": true,
+ "sideEffects": false,
"dependencies": {
"@remix-run/react": "^1.19.2",
"@remix-run/server-runtime": "^1.19.2",
@@ -29,7 +28,6 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@webstudio-is/http-client": "workspace:*",
- "eslint": "^8.48.0",
"typescript": "5.2.2",
"webstudio-cli": "workspace:*"
},
diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts
index eec4dc4b1e..4c3d2da2f6 100644
--- a/packages/cli/src/commands/build.ts
+++ b/packages/cli/src/commands/build.ts
@@ -20,6 +20,7 @@ export const buildOptions = (yargs: CommonYargsArgv) =>
})
.option("template", {
type: "string",
+ default: "vercel",
describe: "[Experimental] Template to use for the build",
});
diff --git a/packages/cli/src/commands/init-flow.ts b/packages/cli/src/commands/init-flow.ts
index aaa9d0cea4..fcace29e06 100644
--- a/packages/cli/src/commands/init-flow.ts
+++ b/packages/cli/src/commands/init-flow.ts
@@ -16,6 +16,7 @@ export const initFlow = async (
const isProjectConfigured = await isFileExists(".webstudio/config.json");
let shouldInstallDeps = false;
let folderName;
+ let projectTemplate;
if (isProjectConfigured === false) {
const { shouldCreateFolder } = await prompt({
@@ -53,6 +54,36 @@ export const initFlow = async (
}
await link({ link: projectLink });
+ const { shouldSetupDeployTarget } = await prompt({
+ type: "confirm",
+ name: "shouldSetupDeployTarget",
+ message: "Would you like to setup a deploy target?",
+ initial: false,
+ });
+
+ if (shouldSetupDeployTarget === true) {
+ const { deployTarget } = await prompt({
+ type: "select",
+ name: "deployTarget",
+ message: "Where would you like to deploy your project?",
+ choices: [
+ {
+ title: "Vercel",
+ value: "vercel",
+ },
+ {
+ title: "Netlify Functions",
+ value: "netlify-functions",
+ },
+ {
+ title: "Netlify Edge Functions",
+ value: "netlify-edge-functions",
+ },
+ ],
+ });
+ projectTemplate = deployTarget;
+ }
+
const { installDeps } = await prompt({
type: "confirm",
name: "installDeps",
@@ -63,7 +94,11 @@ export const initFlow = async (
}
await sync({ buildId: undefined, origin: undefined, authToken: undefined });
- await build(options);
+
+ await build({
+ ...options,
+ ...(projectTemplate && { template: projectTemplate }),
+ });
if (shouldInstallDeps === true) {
const spinner = ora().start();
diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.ts
index 3c05ff60a7..c9e9247a85 100644
--- a/packages/cli/src/prebuild.ts
+++ b/packages/cli/src/prebuild.ts
@@ -47,7 +47,12 @@ import * as baseComponentMetas from "@webstudio-is/sdk-components-react/metas";
import * as remixComponentMetas from "@webstudio-is/sdk-components-react-remix/metas";
import * as radixComponentMetas from "@webstudio-is/sdk-components-react-radix/metas";
import { LOCAL_DATA_FILE } from "./config";
-import { ensureFileInPath, ensureFolderExists, loadJSONFile } from "./fs-utils";
+import {
+ ensureFileInPath,
+ ensureFolderExists,
+ loadJSONFile,
+ isFileExists,
+} from "./fs-utils";
import type * as sharedConstants from "~/constants.mjs";
import type { PageData } from "../templates/route-template";
@@ -171,10 +176,12 @@ const copyTemplates = async (template: string = "defaults") => {
},
});
- await mergeJsonFiles(
- join(templatesPath, "package.json"),
- join(cwd(), "package.json")
- );
+ if ((await isFileExists(join(templatesPath, "package.json"))) === true) {
+ await mergeJsonFiles(
+ join(templatesPath, "package.json"),
+ join(cwd(), "package.json")
+ );
+ }
};
export const prebuild = async (options: {
diff --git a/packages/cli/templates/defaults/.vercelignore b/packages/cli/templates/defaults/.vercelignore
deleted file mode 100644
index 6a0e67a2fb..0000000000
--- a/packages/cli/templates/defaults/.vercelignore
+++ /dev/null
@@ -1,8 +0,0 @@
-node_modules
-
-.cache
-.env
-.vercel
-.webstudio
-build
-public/build
diff --git a/packages/cli/templates/defaults/app/constants.mjs b/packages/cli/templates/defaults/app/constants.mjs
index 5a92afbe55..24fd396edf 100644
--- a/packages/cli/templates/defaults/app/constants.mjs
+++ b/packages/cli/templates/defaults/app/constants.mjs
@@ -8,18 +8,6 @@ export const imageBaseUrl = "/assets/";
/**
* @type {import("@webstudio-is/image").ImageLoader}
*/
-export const imageLoader = ({ quality, src, width }) => {
- if (process.env.NODE_ENV !== "production") {
- return imageBaseUrl + src;
- }
-
- // https://vercel.com/blog/build-your-own-web-framework#automatic-image-optimization
- return (
- "/_vercel/image?url=" +
- encodeURIComponent(imageBaseUrl + src) +
- "&w=" +
- width +
- "&q=" +
- quality
- );
+export const imageLoader = ({ src }) => {
+ return imageBaseUrl + src;
};
diff --git a/packages/cli/templates/defaults/package.json b/packages/cli/templates/defaults/package.json
index 88f76b2b90..743b28493d 100644
--- a/packages/cli/templates/defaults/package.json
+++ b/packages/cli/templates/defaults/package.json
@@ -4,7 +4,6 @@
"scripts": {
"build": "remix build",
"dev": "remix dev",
- "start": "remix-serve build",
"typecheck": "tsc"
},
"dependencies": {
@@ -28,7 +27,6 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@webstudio-is/http-client": "^0.100.0",
- "eslint": "^8.48.0",
"typescript": "5.2.2"
},
"engines": {
diff --git a/packages/cli/templates/defaults/vercel.json b/packages/cli/templates/defaults/vercel.json
deleted file mode 100644
index 18097e0c38..0000000000
--- a/packages/cli/templates/defaults/vercel.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "images": {
- "domains": [],
- "sizes": [
- 16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048,
- 3840
- ],
- "minimumCacheTTL": 60,
- "formats": ["image/webp", "image/avif"]
- }
-}
diff --git a/packages/cli/templates/netlify-edge-functions/app/entry.server.tsx b/packages/cli/templates/netlify-edge-functions/app/entry.server.tsx
new file mode 100644
index 0000000000..fb8ea87098
--- /dev/null
+++ b/packages/cli/templates/netlify-edge-functions/app/entry.server.tsx
@@ -0,0 +1,21 @@
+import type { EntryContext } from "@remix-run/node";
+import { RemixServer } from "@remix-run/react";
+import { renderToString } from "react-dom/server";
+
+export default function handleRequest(
+ request: Request,
+ responseStatusCode: number,
+ responseHeaders: Headers,
+ remixContext: EntryContext
+) {
+ const markup = renderToString(
+ <RemixServer context={remixContext} url={request.url} />
+ );
+
+ responseHeaders.set("Content-Type", "text/html");
+
+ return new Response("<!DOCTYPE html>" + markup, {
+ headers: responseHeaders,
+ status: responseStatusCode,
+ });
+}
diff --git a/packages/cli/templates/netlify-edge-functions/netlify.toml b/packages/cli/templates/netlify-edge-functions/netlify.toml
new file mode 100644
index 0000000000..13021f65c8
--- /dev/null
+++ b/packages/cli/templates/netlify-edge-functions/netlify.toml
@@ -0,0 +1,7 @@
+[build]
+command = "npm run build"
+publish = "public"
+
+[dev]
+command = "npm run dev"
+targetPort = 3000
diff --git a/packages/cli/templates/netlify-edge-functions/package.json b/packages/cli/templates/netlify-edge-functions/package.json
new file mode 100644
index 0000000000..1c07858f37
--- /dev/null
+++ b/packages/cli/templates/netlify-edge-functions/package.json
@@ -0,0 +1,11 @@
+{
+ "scripts": {
+ "predev": "node -e \"fs.rmSync('./public/_redirects', { recursive: true, force: true })\"",
+ "start": "netlify serve"
+ },
+ "dependencies": {
+ "@netlify/functions": "^1.3.0",
+ "@netlify/edge-functions": "^2.0.0",
+ "@netlify/remix-edge-adapter": "1.2.0"
+ }
+}
diff --git a/packages/cli/templates/netlify-edge-functions/remix.config.js b/packages/cli/templates/netlify-edge-functions/remix.config.js
new file mode 100644
index 0000000000..229cbb951b
--- /dev/null
+++ b/packages/cli/templates/netlify-edge-functions/remix.config.js
@@ -0,0 +1,29 @@
+const { config } = require("@netlify/remix-edge-adapter");
+const baseConfig =
+ process.env.NODE_ENV === "production"
+ ? config
+ : {
+ ignoredRouteFiles: ["**/.*"],
+ serverModuleFormat: "cjs",
+ serverDependenciesToBundle: [
+ /@webstudio-is\//,
+ "nanoid",
+ "nanostores",
+ "@nanostores/react",
+ "@jsep-plugin/assignment",
+ ],
+ };
+
+/** @type {import('@remix-run/dev').AppConfig} */
+module.exports = {
+ ignoredRouteFiles: ["**/.*"],
+ ...baseConfig,
+ future: {
+ v2_errorBoundary: true,
+ v2_headers: true,
+ v2_meta: true,
+ v2_normalizeFormMethod: true,
+ v2_routeConvention: true,
+ v2_dev: true,
+ },
+};
diff --git a/packages/cli/templates/netlify-edge-functions/server.js b/packages/cli/templates/netlify-edge-functions/server.js
new file mode 100644
index 0000000000..18dc1b517c
--- /dev/null
+++ b/packages/cli/templates/netlify-edge-functions/server.js
@@ -0,0 +1,19 @@
+// Import path interpreted by the Remix compiler
+import * as build from "@remix-run/dev/server-build";
+import { createRequestHandler } from "@netlify/remix-edge-adapter";
+
+export default createRequestHandler({
+ build,
+ // process.env.NODE_ENV is provided by Remix at compile time
+ mode: process.env.NODE_ENV,
+});
+
+export const config = {
+ cache: "manual",
+ path: "/*",
+ // Let the CDN handle requests for static assets, i.e. ^/_assets/*$
+ //
+ // Add other exclusions here, e.g. "^/api/*$" for custom Netlify functions or
+ // custom Netlify Edge Functions
+ excluded_patterns: ["^/_assets/*$"],
+};
diff --git a/packages/cli/templates/netlify-functions/_app_redirects b/packages/cli/templates/netlify-functions/_app_redirects
new file mode 100644
index 0000000000..cf910997da
--- /dev/null
+++ b/packages/cli/templates/netlify-functions/_app_redirects
@@ -0,0 +1,7 @@
+# This template uses this file instead of the typicial Netlify _redirects file.
+# For more information about redirects and rewrites, see https://docs.netlify.com/routing/redirects/.
+
+# Do not remove the line below. This is required to serve the site when deployed.
+/* /.netlify/functions/server 200
+
+# Add other redirects and rewrites here and/or in your netlify.toml
diff --git a/packages/cli/templates/netlify-functions/app/entry.server.tsx b/packages/cli/templates/netlify-functions/app/entry.server.tsx
new file mode 100644
index 0000000000..fb8ea87098
--- /dev/null
+++ b/packages/cli/templates/netlify-functions/app/entry.server.tsx
@@ -0,0 +1,21 @@
+import type { EntryContext } from "@remix-run/node";
+import { RemixServer } from "@remix-run/react";
+import { renderToString } from "react-dom/server";
+
+export default function handleRequest(
+ request: Request,
+ responseStatusCode: number,
+ responseHeaders: Headers,
+ remixContext: EntryContext
+) {
+ const markup = renderToString(
+ <RemixServer context={remixContext} url={request.url} />
+ );
+
+ responseHeaders.set("Content-Type", "text/html");
+
+ return new Response("<!DOCTYPE html>" + markup, {
+ headers: responseHeaders,
+ status: responseStatusCode,
+ });
+}
diff --git a/packages/cli/templates/netlify-functions/netlify.toml b/packages/cli/templates/netlify-functions/netlify.toml
new file mode 100644
index 0000000000..630bab84d0
--- /dev/null
+++ b/packages/cli/templates/netlify-functions/netlify.toml
@@ -0,0 +1,14 @@
+[build]
+command = "remix build && cp _app_redirects public/_redirects"
+publish = "public"
+
+[dev]
+command = "npm run dev"
+targetPort = 3000
+
+[[headers]]
+for = "/build/*"
+
+[headers.values]
+# Set to 60 seconds as an example. You can also add cache headers via Remix. See the documentation on [headers](https://remix.run/docs/en/v1/route/headers) in Remix.
+"Cache-Control" = "public, max-age=60, s-maxage=60"
diff --git a/packages/cli/templates/netlify-functions/package.json b/packages/cli/templates/netlify-functions/package.json
new file mode 100644
index 0000000000..7ff1515d52
--- /dev/null
+++ b/packages/cli/templates/netlify-functions/package.json
@@ -0,0 +1,10 @@
+{
+ "scripts": {
+ "predev": "node -e \"fs.rmSync('./public/_redirects', { recursive: true, force: true })\"",
+ "start": "netlify serve"
+ },
+ "dependencies": {
+ "@netlify/functions": "^1.3.0",
+ "@netlify/remix-adapter": "^1.0.0"
+ }
+}
diff --git a/packages/cli/templates/netlify-functions/remix.config.js b/packages/cli/templates/netlify-functions/remix.config.js
new file mode 100644
index 0000000000..7638e31da8
--- /dev/null
+++ b/packages/cli/templates/netlify-functions/remix.config.js
@@ -0,0 +1,31 @@
+const baseConfig =
+ process.env.NODE_ENV === "production"
+ ? // when running the Netify CLI or building on Netlify, we want to use
+ {
+ server: "./server.js",
+ serverBuildPath: ".netlify/functions-internal/server.js",
+ }
+ : // otherwise support running remix dev, i.e. no custom server
+ undefined;
+
+/** @type {import('@remix-run/dev').AppConfig} */
+module.exports = {
+ ...baseConfig,
+ ignoredRouteFiles: ["**/.*"],
+ serverModuleFormat: "cjs",
+ serverDependenciesToBundle: [
+ /@webstudio-is\//,
+ "nanoid",
+ "nanostores",
+ "@nanostores/react",
+ "@jsep-plugin/assignment",
+ ],
+ future: {
+ v2_errorBoundary: true,
+ v2_headers: true,
+ v2_meta: true,
+ v2_normalizeFormMethod: true,
+ v2_routeConvention: true,
+ v2_dev: true,
+ },
+};
diff --git a/packages/cli/templates/netlify-functions/server.js b/packages/cli/templates/netlify-functions/server.js
new file mode 100644
index 0000000000..6997ce381f
--- /dev/null
+++ b/packages/cli/templates/netlify-functions/server.js
@@ -0,0 +1,7 @@
+import { createRequestHandler } from "@netlify/remix-adapter";
+import * as build from "@remix-run/dev/server-build";
+
+export const handler = createRequestHandler({
+ build,
+ mode: process.env.NODE_ENV,
+});
diff --git a/fixtures/webstudio-custom-template/.vercelignore b/packages/cli/templates/vercel/.vercelignore
similarity index 100%
rename from fixtures/webstudio-custom-template/.vercelignore
rename to packages/cli/templates/vercel/.vercelignore
diff --git a/packages/cli/templates/vercel/app/constants.mjs b/packages/cli/templates/vercel/app/constants.mjs
new file mode 100644
index 0000000000..5a92afbe55
--- /dev/null
+++ b/packages/cli/templates/vercel/app/constants.mjs
@@ -0,0 +1,25 @@
+/**
+ * We use mjs extension as constants in this file is shared with the build script
+ * and we use `node --eval` to extract the constants.
+ */
+export const assetBaseUrl = "/assets/";
+export const imageBaseUrl = "/assets/";
+
+/**
+ * @type {import("@webstudio-is/image").ImageLoader}
+ */
+export const imageLoader = ({ quality, src, width }) => {
+ if (process.env.NODE_ENV !== "production") {
+ return imageBaseUrl + src;
+ }
+
+ // https://vercel.com/blog/build-your-own-web-framework#automatic-image-optimization
+ return (
+ "/_vercel/image?url=" +
+ encodeURIComponent(imageBaseUrl + src) +
+ "&w=" +
+ width +
+ "&q=" +
+ quality
+ );
+};
diff --git a/packages/cli/templates/vercel/package.json b/packages/cli/templates/vercel/package.json
new file mode 100644
index 0000000000..ae44a6899a
--- /dev/null
+++ b/packages/cli/templates/vercel/package.json
@@ -0,0 +1,5 @@
+{
+ "scripts": {
+ "start": "remix-serve build"
+ }
+}
diff --git a/fixtures/webstudio-custom-template/vercel.json b/packages/cli/templates/vercel/vercel.json
similarity index 100%
rename from fixtures/webstudio-custom-template/vercel.json
rename to packages/cli/templates/vercel/vercel.json
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ae9dc1985d..6092b767b5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -428,9 +428,149 @@ importers:
'@webstudio-is/http-client':
specifier: workspace:*
version: link:../../packages/http-client
- eslint:
- specifier: ^8.48.0
- version: 8.48.0
+ typescript:
+ specifier: 5.2.2
+ version: 5.2.2
+ webstudio-cli:
+ specifier: workspace:*
+ version: link:../../packages/cli
+
+ fixtures/webstudio-remix-netlify-edge-functions:
+ dependencies:
+ '@netlify/edge-functions':
+ specifier: ^2.0.0
+ version: 2.0.0
+ '@netlify/functions':
+ specifier: ^1.3.0
+ version: 1.3.0
+ '@netlify/remix-edge-adapter':
+ specifier: 1.2.0
+ version: 1.2.0
+ '@remix-run/node':
+ specifier: ^1.19.2
+ version: 1.19.2
+ '@remix-run/react':
+ specifier: ^1.19.2
+ '@remix-run/server-runtime':
+ specifier: ^1.19.2
+ version: 1.19.2
+ '@webstudio-is/form-handlers':
+ specifier: workspace:*
+ version: link:../../packages/form-handlers
+ '@webstudio-is/image':
+ specifier: workspace:*
+ version: link:../../packages/image
+ '@webstudio-is/react-sdk':
+ specifier: workspace:*
+ version: link:../../packages/react-sdk
+ '@webstudio-is/sdk':
+ specifier: workspace:*
+ version: link:../../packages/sdk
+ '@webstudio-is/sdk-components-react':
+ specifier: workspace:*
+ version: link:../../packages/sdk-components-react
+ '@webstudio-is/sdk-components-react-radix':
+ specifier: workspace:*
+ version: link:../../packages/sdk-components-react-radix
+ '@webstudio-is/sdk-components-react-remix':
+ specifier: workspace:*
+ version: link:../../packages/sdk-components-react-remix
+ isbot:
+ specifier: ^3.6.8
+ version: 3.6.13
+ react:
+ specifier: ^18.2.0
+ version: 18.2.0
+ react-dom:
+ specifier: ^18.2.0
+ version: 18.2.0([email protected])
+ devDependencies:
+ '@remix-run/dev':
+ specifier: ^1.19.2
+ version: 1.19.2(@remix-run/[email protected])
+ '@remix-run/serve':
+ specifier: ^1.19.2
+ version: 1.19.2
+ '@types/react':
+ specifier: ^18.2.20
+ version: 18.2.21
+ '@types/react-dom':
+ specifier: ^18.2.7
+ version: 18.2.7
+ '@webstudio-is/http-client':
+ specifier: workspace:*
+ version: link:../../packages/http-client
+ typescript:
+ specifier: 5.2.2
+ version: 5.2.2
+ webstudio-cli:
+ specifier: workspace:*
+ version: link:../../packages/cli
+
+ fixtures/webstudio-remix-netlify-functions:
+ dependencies:
+ '@netlify/functions':
+ specifier: ^1.3.0
+ version: 1.3.0
+ '@netlify/remix-adapter':
+ specifier: ^1.0.0
+ version: 1.0.0(@netlify/[email protected])
+ '@remix-run/node':
+ specifier: ^1.19.2
+ version: 1.19.2
+ '@remix-run/react':
+ specifier: ^1.19.2
+ '@remix-run/server-runtime':
+ specifier: ^1.19.2
+ version: 1.19.2
+ '@webstudio-is/form-handlers':
+ specifier: workspace:*
+ version: link:../../packages/form-handlers
+ '@webstudio-is/image':
+ specifier: workspace:*
+ version: link:../../packages/image
+ '@webstudio-is/react-sdk':
+ specifier: workspace:*
+ version: link:../../packages/react-sdk
+ '@webstudio-is/sdk':
+ specifier: workspace:*
+ version: link:../../packages/sdk
+ '@webstudio-is/sdk-components-react':
+ specifier: workspace:*
+ version: link:../../packages/sdk-components-react
+ '@webstudio-is/sdk-components-react-radix':
+ specifier: workspace:*
+ version: link:../../packages/sdk-components-react-radix
+ '@webstudio-is/sdk-components-react-remix':
+ specifier: workspace:*
+ version: link:../../packages/sdk-components-react-remix
+ isbot:
+ specifier: ^3.6.8
+ version: 3.6.13
+ react:
+ specifier: ^18.2.0
+ version: 18.2.0
+ react-dom:
+ specifier: ^18.2.0
+ version: 18.2.0([email protected])
+ devDependencies:
+ '@remix-run/dev':
+ specifier: ^1.19.2
+ version: 1.19.2(@remix-run/[email protected])
+ '@remix-run/serve':
+ specifier: ^1.19.2
+ version: 1.19.2
+ '@types/react':
+ specifier: ^18.2.20
+ version: 18.2.21
+ '@types/react-dom':
+ specifier: ^18.2.7
+ version: 18.2.7
+ '@webstudio-is/http-client':
+ specifier: workspace:*
+ version: link:../../packages/http-client
typescript:
specifier: 5.2.2
version: 5.2.2
@@ -495,9 +635,6 @@ importers:
'@webstudio-is/http-client':
specifier: workspace:*
version: link:../../packages/http-client
- eslint:
- specifier: ^8.48.0
- version: 8.48.0
typescript:
specifier: 5.2.2
version: 5.2.2
@@ -1715,6 +1852,7 @@ packages:
/@aashutoshrathi/[email protected]:
resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==}
engines: {node: '>=0.10.0'}
+ dev: false
resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}
@@ -3033,6 +3171,17 @@ packages:
requiresBuild: true
optional: true
+ resolution: {integrity: sha512-Ge0Tnl7zZY0VvEfgsyLhjid8DzI1d0La0dgm+3m0/A8gZXgp5xwlyIyue5e4SCUuVB/3AH/0lun9LcJhhTwmbg==}
+ dev: false
+
+ resolution: {integrity: sha512-E7rQ0Hk33V45xQXKEnCxizdSP5C+hhqw1H3xWXsct3kYFWgG93B5gN3LKlyvcxbckt8d67jVa6s+y5duRYawvg==}
+ dependencies:
+ '@deno/shim-deno-test': 0.3.3
+ which: 2.0.2
+ dev: false
+
/@discoveryjs/[email protected]:
resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==}
engines: {node: '>=10.0.0'}
@@ -3844,10 +3993,12 @@ packages:
dependencies:
eslint: 8.48.0
eslint-visitor-keys: 3.4.3
+ dev: false
/@eslint-community/[email protected]:
resolution: {integrity: sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
+ dev: false
resolution: {integrity: sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==}
@@ -3864,10 +4015,12 @@ packages:
strip-json-comments: 3.1.1
transitivePeerDependencies:
- supports-color
+ dev: false
resolution: {integrity: sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ dev: false
/@fal-works/[email protected]:
resolution: {integrity: sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==}
@@ -3925,13 +4078,16 @@ packages:
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
+ dev: false
/@humanwhocodes/[email protected]:
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
engines: {node: '>=12.22'}
+ dev: false
/@humanwhocodes/[email protected]:
resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==}
+ dev: false
resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==}
@@ -4699,6 +4855,42 @@ packages:
pump: 3.0.0
tar-fs: 2.1.1
+ /@netlify/[email protected]:
+ resolution: {integrity: sha512-mRVGnPNA4YayDLPwnO1ZrcWwBODPj5BQPbx3/FUlQtZ5ow2D+PjMPQr8IcFm0HfMJQgtHZS39p9VS6PRSi1ePw==}
+ engines: {node: ^14.16.0 || >=16.0.0}
+ dependencies:
+ '@deno/shim-deno': 0.10.0
+ dev: false
+
+ /@netlify/[email protected]:
+ resolution: {integrity: sha512-hN/Fgpz8XIOBfsBPLYUMxVKBlCopgeqGB0popayicnmkFLnvKByTTMYgF01wcF9DBtBQdV0H2h1kPFpMl34I8w==}
+ engines: {node: '>=8.3.0'}
+ dependencies:
+ is-promise: 4.0.0
+ dev: false
+
+ /@netlify/[email protected](@netlify/[email protected]):
+ resolution: {integrity: sha512-4lI6cPybkXvElk1Wn8FbowxH6xWOX9rG9e963YFIzpyCTV61pu7JA+MDNPw18tZCOkzBfXqTFP/qqdm7Uleudg==}
+ engines: {node: '>=14'}
+ peerDependencies:
+ '@netlify/functions': ^1.0.0
+ dependencies:
+ '@netlify/functions': 1.3.0
+ '@remix-run/node': 1.19.2
+ dev: false
+
+ /@netlify/[email protected]:
+ resolution: {integrity: sha512-tviSW+Bu+Z56aCr4TnEYNaUgDUhDZOyimYoigGzFmjQhq3yGmOpSTkkp2WBNR+JuRIFH2MsqV+eCFoBVrAy/7g==}
+ dependencies:
+ '@netlify/remix-runtime': 1.1.0
+ dev: false
+
+ /@netlify/[email protected]:
+ resolution: {integrity: sha512-9v/j6kEvsnaD3uStLVng2HJhWBVjZ78SmiWMpgUVbOJyStrhz5ivqsoU54m47kCwviKXhWt36U8RYczgMgkG+w==}
+ dependencies:
+ '@remix-run/server-runtime': 1.19.2
+ dev: false
+
/@nodelib/[email protected]:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -7984,6 +8176,7 @@ packages:
fast-json-stable-stringify: 2.1.0
json-schema-traverse: 0.4.1
uri-js: 4.4.1
+ dev: false
resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==}
@@ -9096,6 +9289,7 @@ packages:
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
+ dev: false
resolution: {integrity: sha512-Rn+RuwkmkDwCi2/oXOFS9Gsr5lJZu/yTGpK7wAaAIE75CC+LCGEZHpY6VQJa/RoJcrmaA/docWJZvYohlNkWPA==}
@@ -9811,10 +10005,12 @@ packages:
dependencies:
esrecurse: 4.3.0
estraverse: 5.3.0
+ dev: false
resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
+ dev: false
resolution: {integrity: sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==}
@@ -9860,6 +10056,7 @@ packages:
text-table: 0.2.0
transitivePeerDependencies:
- supports-color
+ dev: false
resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
@@ -9868,6 +10065,7 @@ packages:
acorn: 8.10.0
acorn-jsx: 5.3.2([email protected])
eslint-visitor-keys: 3.4.3
+ dev: false
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
@@ -9879,12 +10077,14 @@ packages:
engines: {node: '>=0.10'}
dependencies:
estraverse: 5.3.0
+ dev: false
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
engines: {node: '>=4.0'}
dependencies:
estraverse: 5.3.0
+ dev: false
resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==}
@@ -10094,6 +10294,7 @@ packages:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+ dev: false
resolution: {integrity: sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==}
@@ -10121,6 +10322,7 @@ packages:
resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}
+ dev: false
resolution: {integrity: sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw==}
@@ -10174,6 +10376,7 @@ packages:
engines: {node: ^10.12.0 || >=12.0.0}
dependencies:
flat-cache: 3.0.4
+ dev: false
resolution: {integrity: sha512-l4DMNdsIPsVnKrgEXbJwDJsA5mB8rGwHYERMgqQx/xAUtChPJMre1bXBzDEqqVbWv9AIbFezXMxeEkZDSrXUOQ==}
@@ -10253,9 +10456,11 @@ packages:
dependencies:
flatted: 3.2.7
rimraf: 3.0.2
+ dev: false
resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==}
+ dev: false
resolution: {integrity: sha512-7YdhWfCsLRn31or7oK9M7Svd4WFk1qfj6VIFY/9S6HRyzBBiLlobNbUbitZHfdi0nhkik5S498UmF3phdzM6ug==}
@@ -10595,6 +10800,7 @@ packages:
engines: {node: '>=8'}
dependencies:
type-fest: 0.20.2
+ dev: false
resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==}
@@ -10663,6 +10869,7 @@ packages:
resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
+ dev: false
resolution: {integrity: sha512-4haO1M4mLO91PW57BMsDFf75UmwoRX0GkdD+Faw+Lr+r/OZrOCS0pIBwOL1xCKQqnQzbNFGgK2V2CpBUPeFNTw==}
@@ -10899,6 +11106,7 @@ packages:
dependencies:
parent-module: 1.0.1
resolve-from: 4.0.0
+ dev: false
resolution: {integrity: sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==}
@@ -11197,6 +11405,10 @@ packages:
resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}
+ dev: false
+
resolution: {integrity: sha512-baJJdQLiYaJdvFbJqXrcGv3WU3QCzBlUcI5QhbesIm6/xPsvmO+2CDoi/GMOFBQEQm+PXkwOPrp9KK5ozZsp2w==}
dependencies:
@@ -11902,9 +12114,11 @@ packages:
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
+ dev: false
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
+ dev: false
resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==}
@@ -11980,6 +12194,7 @@ packages:
dependencies:
prelude-ls: 1.2.1
type-check: 0.4.0
+ dev: false
resolution: {integrity: sha512-xsMKgx/Fa+QHg/nweemU04lCy7TnEr8LyeDtsKUC7fIDN9wH3GqbnQ0+e3Hbg4FmxlhDCiPPt0GcZAROq3R8uw==}
@@ -12051,6 +12266,7 @@ packages:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
+ dev: false
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
@@ -13542,6 +13758,7 @@ packages:
levn: 0.4.1
prelude-ls: 1.2.1
type-check: 0.4.0
+ dev: false
resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==}
@@ -13673,6 +13890,7 @@ packages:
engines: {node: '>=6'}
dependencies:
callsites: 3.1.0
+ dev: false
resolution: {integrity: sha512-5nk9Fn03x3rEhGaX1FU6IDwG/k+GxLXlFAkgrbM1asuAFl3BhdQWvASaIsmwWypRNcZKHPYnIuOSfIWEyEQnPQ==}
@@ -13978,6 +14196,7 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
+ dev: false
resolution: {integrity: sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==}
@@ -14114,6 +14333,7 @@ packages:
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
engines: {node: '>=6'}
+ dev: false
resolution: {integrity: sha512-n13AWriBMPYxnpbb6bnaY5YoY6rGj8vPLrz6CZF3o0qJNEwlcfJVxBzYZ0NJsQ21UbdJoijPCDrM++SUVEz7+w==}
@@ -14753,6 +14973,7 @@ packages:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'}
+ dev: false
resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==}
@@ -15553,6 +15774,7 @@ packages:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
+ dev: false
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
@@ -15781,6 +16003,7 @@ packages:
engines: {node: '>= 0.8.0'}
dependencies:
prelude-ls: 1.2.1
+ dev: false
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
@@ -15793,6 +16016,7 @@ packages:
resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
engines: {node: '>=10'}
+ dev: false
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
@@ -16111,6 +16335,7 @@ packages:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
dependencies:
punycode: 2.3.0
+ dev: false
resolution: {integrity: sha512-DOE84vZT2fEcl9gqCUTcnAw5ZY5Id55ikUcziSUntuEFL3pRvavg5kwDmTEUJkeCHInTlV/HexFomgYnzO5kdQ==}