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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Add raw image upload support to the cli (#2301)
Ivan Starkovd41534552c4d
diff --git a/fixtures/webstudio-remix-vercel/.webstudio/data.json b/fixtures/webstudio-remix-vercel/.webstudio/data.jsonindex ae5103dd13..ccd92cb970 100644--- a/fixtures/webstudio-remix-vercel/.webstudio/data.json+++ b/fixtures/webstudio-remix-vercel/.webstudio/data.json@@ -1,9 +1,9 @@{"build": {- "id": "28c64803-aa0f-4518-aa58-98d7f6fbea93",+ "id": "347fa050-f487-412e-a67e-f03f8e3715bc","projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",- "version": 60,- "createdAt": "2023-09-08T13:18:10.222Z",+ "version": 107,+ "createdAt": "2023-09-12T09:48:01.245Z","pages": {"homePage": {"id": "7Db64ZXgYiRqKSQNR-qTQ",@@ -25,34 +25,14 @@"path": "/radix"},{- "id": "w9Qwfu1HOP397jLNtq-hc",- "name": "Blog",- "title": "Blog",+ "id": "szYLvBduHPmbtqQKCDY0b",+ "name": "RouteWithSymbols",+ "title": "RouteWithSymbols","meta": {"description": ""},- "rootInstanceId": "xDnAIGJjaOVjOfMU6bbxQ",- "path": "/blog"- },- {- "id": "hd6G3bz113YtoxD-3lNAI",- "name": "Page",- "title": "Page",- "meta": {- "description": ""- },- "rootInstanceId": "nEyRUCIYmfkBYUb-MSdDd",- "path": "/blog/page"- },- {- "id": "FGakc6C75caW7hRRn_0lZ",- "name": "deep-nested-page",- "title": "deep-nested-page",- "meta": {- "description": ""- },- "rootInstanceId": "P_qm1M69qwe6M2aaNBzOH",- "path": "/blog/page/deep-nested-page"+ "rootInstanceId": "EDEfpMPRqDejthtwkH7ws",+ "path": "/_route_with_symbols_"}]},@@ -1336,6 +1316,19 @@"value": 1}}+ ],+ [+ "49DYl_wcHv6juFsJK5Qv3:UoTkWyaFuTYJihS3MFYK5:aspectRatio:",+ {+ "breakpointId": "UoTkWyaFuTYJihS3MFYK5",+ "styleSourceId": "49DYl_wcHv6juFsJK5Qv3",+ "property": "aspectRatio",+ "value": {+ "type": "unit",+ "unit": "number",+ "value": 1+ }+ }]],"styleSources": [@@ -1485,6 +1478,13 @@"type": "local","id": "EG1HUMyU4Rw4xD2pnGi28"}+ ],+ [+ "49DYl_wcHv6juFsJK5Qv3",+ {+ "type": "local",+ "id": "49DYl_wcHv6juFsJK5Qv3"+ }]],"styleSourceSelections": [@@ -1634,6 +1634,13 @@"instanceId": "mOVPnIrlt6IwVAzI_i2Fc","values": ["EG1HUMyU4Rw4xD2pnGi28"]}+ ],+ [+ "AdXSAYCx4QDo5QN6nLoGs",+ {+ "instanceId": "AdXSAYCx4QDo5QN6nLoGs",+ "values": ["49DYl_wcHv6juFsJK5Qv3"]+ }]],"props": [@@ -1722,6 +1729,26 @@"type": "string","value": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" width=\"100%\" height=\"100%\" style=\"display: block;\"><path d=\"M4.04 6.284a.65.65 0 0 1 .92.001L8 9.335l3.04-3.05a.65.65 0 1 1 .921.918l-3.5 3.512a.65.65 0 0 1-.921 0L4.039 7.203a.65.65 0 0 1 .001-.92Z\"/></svg>"}+ ],+ [+ "HNaXZUvlg14jFvxc29n9T",+ {+ "id": "HNaXZUvlg14jFvxc29n9T",+ "instanceId": "AdXSAYCx4QDo5QN6nLoGs",+ "name": "src",+ "type": "asset",+ "value": "9a8bc926-7804-4d3f-af81-69196b1d2ed8"+ }+ ],+ [+ "tUn-hTQ0dKjsaRZ4q3m21",+ {+ "id": "tUn-hTQ0dKjsaRZ4q3m21",+ "instanceId": "9I4GRU1sev48hREkQcKQ-",+ "name": "href",+ "type": "page",+ "value": "szYLvBduHPmbtqQKCDY0b"+ }]],"dataSources": [@@ -1808,6 +1835,14 @@{"type": "id","value": "l9AI_pShC-BH4ibxK6kNT"+ },+ {+ "type": "id",+ "value": "82HYqzxZeahPxSDFNWem5"+ },+ {+ "type": "id",+ "value": "9I4GRU1sev48hREkQcKQ-"}]}@@ -2223,141 +2258,50 @@}],[- "xDnAIGJjaOVjOfMU6bbxQ",- {- "type": "instance",- "id": "xDnAIGJjaOVjOfMU6bbxQ",- "component": "Body",- "children": [- {- "type": "id",- "value": "JemPdaC7WmuopS5GTRaRZ"- },- {- "type": "id",- "value": "FZ3JS5mYbAWT3EyQexnaS"- }- ]- }- ],- [- "JemPdaC7WmuopS5GTRaRZ",- {- "type": "instance",- "id": "JemPdaC7WmuopS5GTRaRZ",- "component": "Heading",- "children": [- {- "type": "text",- "value": "Blog"- }- ]- }- ],- [- "FZ3JS5mYbAWT3EyQexnaS",+ "EDEfpMPRqDejthtwkH7ws",{"type": "instance",- "id": "FZ3JS5mYbAWT3EyQexnaS",- "component": "Link",- "children": [- {- "type": "text",- "value": "Link text you can edit"- }- ]- }- ],- [- "nEyRUCIYmfkBYUb-MSdDd",- {- "type": "instance",- "id": "nEyRUCIYmfkBYUb-MSdDd",+ "id": "EDEfpMPRqDejthtwkH7ws","component": "Body","children": [{"type": "id",- "value": "oX13CSOxZaPn94ukbUaW3"- },- {- "type": "id",- "value": "M4cBN9R79h4ZxP8IlqmFp"+ "value": "AdXSAYCx4QDo5QN6nLoGs"}]}],[- "oX13CSOxZaPn94ukbUaW3",+ "AdXSAYCx4QDo5QN6nLoGs",{"type": "instance",- "id": "oX13CSOxZaPn94ukbUaW3",- "component": "Heading",- "children": [- {- "type": "text",- "value": "Page"- }- ]+ "id": "AdXSAYCx4QDo5QN6nLoGs",+ "component": "Image",+ "label": "webp image, used to test raw image uploads",+ "children": []}],[- "M4cBN9R79h4ZxP8IlqmFp",+ "9I4GRU1sev48hREkQcKQ-",{"type": "instance",- "id": "M4cBN9R79h4ZxP8IlqmFp",+ "id": "9I4GRU1sev48hREkQcKQ-","component": "Link","children": [{"type": "text",- "value": "Link text you can edit"- }- ]- }- ],- [- "P_qm1M69qwe6M2aaNBzOH",- {- "type": "instance",- "id": "P_qm1M69qwe6M2aaNBzOH",- "component": "Body",- "children": [- {- "type": "id",- "value": "UG0MSNfRWyyac4KR3fFyg"- },- {- "type": "id",- "value": "Zh_5yzptz6BB60Va6TlVv"- }- ]- }- ],- [- "UG0MSNfRWyyac4KR3fFyg",- {- "type": "instance",- "id": "UG0MSNfRWyyac4KR3fFyg",- "component": "Heading",- "children": [- {- "type": "text",- "value": "Deep nested"+ "value": "Symbols in path"}]}],[- "Zh_5yzptz6BB60Va6TlVv",+ "82HYqzxZeahPxSDFNWem5",{"type": "instance",- "id": "Zh_5yzptz6BB60Va6TlVv",- "component": "Link",- "children": [- {- "type": "text",- "value": "Link text you can edit"- }- ]+ "id": "82HYqzxZeahPxSDFNWem5",+ "component": "Box",+ "children": []}]],@@ -2394,37 +2338,31 @@"path": "/radix"},{- "id": "w9Qwfu1HOP397jLNtq-hc",- "name": "Blog",- "title": "Blog",- "meta": {- "description": ""- },- "rootInstanceId": "xDnAIGJjaOVjOfMU6bbxQ",- "path": "/blog"- },- {- "id": "hd6G3bz113YtoxD-3lNAI",- "name": "Page",- "title": "Page",- "meta": {- "description": ""- },- "rootInstanceId": "nEyRUCIYmfkBYUb-MSdDd",- "path": "/blog/page"- },- {- "id": "FGakc6C75caW7hRRn_0lZ",- "name": "deep-nested-page",- "title": "deep-nested-page",+ "id": "szYLvBduHPmbtqQKCDY0b",+ "name": "RouteWithSymbols",+ "title": "RouteWithSymbols","meta": {"description": ""},- "rootInstanceId": "P_qm1M69qwe6M2aaNBzOH",- "path": "/blog/page/deep-nested-page"+ "rootInstanceId": "EDEfpMPRqDejthtwkH7ws",+ "path": "/_route_with_symbols_"}],"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",diff --git a/fixtures/webstudio-remix-vercel/README.md b/fixtures/webstudio-remix-vercel/README.mdindex e7be01f450..c23e315438 100644--- a/fixtures/webstudio-remix-vercel/README.md+++ b/fixtures/webstudio-remix-vercel/README.md@@ -13,7 +13,7 @@ pnpm devpnpm webstudio-cli link# add following link https://webstudio-builder-git-main-webstudio-is.vercel.app/builder/cddc1d44-af37-4cb6-a430-d300cf6f932d?authToken=1cdc6026-dd5b-4624-b89b-9bd45e9bcc3d&mode=preview-pnpm webstudio-cli sync+pnpm webstudio-cli sync && pnpm prettier --write ./.webstudio/# data.json generatedpnpm webstudio-cli build --preview && pnpm prettier --write ./app/diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[blog]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsxsimilarity index 69%rename from fixtures/webstudio-remix-vercel/app/__generated__/[blog]._index.tsxrename to fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsxindex 4f992bf5f1..af671d291d 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[blog]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.tsx@@ -7,46 +7,45 @@ import type { Components } from "@webstudio-is/react-sdk";import type { Asset } from "@webstudio-is/sdk";import {Body as Body,- Heading as Heading,+ Image as Image,} from "@webstudio-is/sdk-components-react";-import { Link as Link } from "@webstudio-is/sdk-components-react-remix";export const components = new Map(- Object.entries({ Body: Body, Heading: Heading, Link: Link })+ Object.entries({ Body: Body, Image: Image })) as Components;export const fontAssets: Asset[] = [];export const pageData: PageData = {build: {- props: [],- instances: [+ props: [[- "xDnAIGJjaOVjOfMU6bbxQ",+ "HNaXZUvlg14jFvxc29n9T",{- type: "instance",- id: "xDnAIGJjaOVjOfMU6bbxQ",- component: "Body",- children: [- { type: "id", value: "JemPdaC7WmuopS5GTRaRZ" },- { type: "id", value: "FZ3JS5mYbAWT3EyQexnaS" },- ],+ id: "HNaXZUvlg14jFvxc29n9T",+ instanceId: "AdXSAYCx4QDo5QN6nLoGs",+ name: "src",+ type: "asset",+ value: "9a8bc926-7804-4d3f-af81-69196b1d2ed8",},],+ ],+ instances: [[- "JemPdaC7WmuopS5GTRaRZ",+ "EDEfpMPRqDejthtwkH7ws",{type: "instance",- id: "JemPdaC7WmuopS5GTRaRZ",- component: "Heading",- children: [{ type: "text", value: "Blog" }],+ id: "EDEfpMPRqDejthtwkH7ws",+ component: "Body",+ children: [{ type: "id", value: "AdXSAYCx4QDo5QN6nLoGs" }],},],[- "FZ3JS5mYbAWT3EyQexnaS",+ "AdXSAYCx4QDo5QN6nLoGs",{type: "instance",- id: "FZ3JS5mYbAWT3EyQexnaS",- component: "Link",- children: [{ type: "text", value: "Link text you can edit" }],+ id: "AdXSAYCx4QDo5QN6nLoGs",+ component: "Image",+ label: "webp image, used to test raw image uploads",+ children: [],},],],@@ -70,39 +69,34 @@ export const pageData: PageData = {path: "/radix",},{- id: "w9Qwfu1HOP397jLNtq-hc",- name: "Blog",- title: "Blog",- meta: { description: "" },- rootInstanceId: "xDnAIGJjaOVjOfMU6bbxQ",- path: "/blog",- },- {- id: "hd6G3bz113YtoxD-3lNAI",- name: "Page",- title: "Page",+ id: "szYLvBduHPmbtqQKCDY0b",+ name: "RouteWithSymbols",+ title: "RouteWithSymbols",meta: { description: "" },- rootInstanceId: "nEyRUCIYmfkBYUb-MSdDd",- path: "/blog/page",- },- {- id: "FGakc6C75caW7hRRn_0lZ",- name: "deep-nested-page",- title: "deep-nested-page",- meta: { description: "" },- rootInstanceId: "P_qm1M69qwe6M2aaNBzOH",- path: "/blog/page/deep-nested-page",+ rootInstanceId: "EDEfpMPRqDejthtwkH7ws",+ path: "/_route_with_symbols_",},],page: {- id: "w9Qwfu1HOP397jLNtq-hc",- name: "Blog",- title: "Blog",+ id: "szYLvBduHPmbtqQKCDY0b",+ name: "RouteWithSymbols",+ title: "RouteWithSymbols",meta: { description: "" },- rootInstanceId: "xDnAIGJjaOVjOfMU6bbxQ",- path: "/blog",+ rootInstanceId: "EDEfpMPRqDejthtwkH7ws",+ path: "/_route_with_symbols_",},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",diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[blog].[page].[deep-nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[blog].[page].[deep-nested-page]._index.tsxdeleted file mode 100644index ed5fa098e1..0000000000--- a/fixtures/webstudio-remix-vercel/app/__generated__/[blog].[page].[deep-nested-page]._index.tsx+++ /dev/null@@ -1,176 +0,0 @@-/* eslint-disable */-/* This is a auto generated file for building the project */--import * as sdk from "@webstudio-is/react-sdk";-import type { PageData } from "~/routes/_index";-import type { Components } from "@webstudio-is/react-sdk";-import type { Asset } from "@webstudio-is/sdk";-import {- Body as Body,- Heading as Heading,-} from "@webstudio-is/sdk-components-react";-import { Link as Link } from "@webstudio-is/sdk-components-react-remix";--export const components = new Map(- Object.entries({ Body: Body, Heading: Heading, Link: Link })-) as Components;-export const fontAssets: Asset[] = [];-export const pageData: PageData = {- build: {- props: [],- instances: [- [- "P_qm1M69qwe6M2aaNBzOH",- {- type: "instance",- id: "P_qm1M69qwe6M2aaNBzOH",- component: "Body",- children: [- { type: "id", value: "UG0MSNfRWyyac4KR3fFyg" },- { type: "id", value: "Zh_5yzptz6BB60Va6TlVv" },- ],- },- ],- [- "UG0MSNfRWyyac4KR3fFyg",- {- type: "instance",- id: "UG0MSNfRWyyac4KR3fFyg",- component: "Heading",- children: [{ type: "text", value: "Deep nested" }],- },- ],- [- "Zh_5yzptz6BB60Va6TlVv",- {- type: "instance",- id: "Zh_5yzptz6BB60Va6TlVv",- component: "Link",- children: [{ type: "text", value: "Link text you can edit" }],- },- ],- ],- dataSources: [],- },- 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: "w9Qwfu1HOP397jLNtq-hc",- name: "Blog",- title: "Blog",- meta: { description: "" },- rootInstanceId: "xDnAIGJjaOVjOfMU6bbxQ",- path: "/blog",- },- {- id: "hd6G3bz113YtoxD-3lNAI",- name: "Page",- title: "Page",- meta: { description: "" },- rootInstanceId: "nEyRUCIYmfkBYUb-MSdDd",- path: "/blog/page",- },- {- id: "FGakc6C75caW7hRRn_0lZ",- name: "deep-nested-page",- title: "deep-nested-page",- meta: { description: "" },- rootInstanceId: "P_qm1M69qwe6M2aaNBzOH",- path: "/blog/page/deep-nested-page",- },- ],- page: {- id: "FGakc6C75caW7hRRn_0lZ",- name: "deep-nested-page",- title: "deep-nested-page",- meta: { description: "" },- rootInstanceId: "P_qm1M69qwe6M2aaNBzOH",- path: "/blog/page/deep-nested-page",- },- assets: [- {- 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";--/* eslint-disable */--const indexesWithinAncestors = new Map<string, number>([]);--const rawExecuteComputingExpressions = (- _variables: Map<string, unknown>-): Map<string, unknown> => {- return new Map([]);-};-const executeComputingExpressions = (variables: Map<string, unknown>) => {- const encodedvariables = sdk.encodeVariablesMap(variables);- const encodedResult = rawExecuteComputingExpressions(encodedvariables);- return sdk.decodeVariablesMap(encodedResult);-};--const generatedEffectfulExpressions = new Map<- string,- (args: Map<string, any>, variables: Map<string, any>) => Map<string, unknown>->([]);--const rawExecuteEffectfulExpression = (- code: string,- args: Map<string, unknown>,- variables: Map<string, unknown>-): Map<string, unknown> => {- if (generatedEffectfulExpressions.has(code)) {- return generatedEffectfulExpressions.get(code)!(args, variables);- }- console.error("Effectful expression not found", code);- throw new Error("Effectful expression not found");-};--const executeEffectfulExpression = (- code: string,- args: Map<string, unknown>,- variables: Map<string, unknown>-) => {- const encodedvariables = sdk.encodeVariablesMap(variables);- const encodedResult = rawExecuteEffectfulExpression(- code,- args,- encodedvariables- );- return sdk.decodeVariablesMap(encodedResult);-};--export const utils = {- indexesWithinAncestors,- executeComputingExpressions,- executeEffectfulExpression,-};--/* eslint-enable */diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[blog].[page]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[blog].[page]._index.tsxdeleted file mode 100644index 8ead282d40..0000000000--- a/fixtures/webstudio-remix-vercel/app/__generated__/[blog].[page]._index.tsx+++ /dev/null@@ -1,176 +0,0 @@-/* eslint-disable */-/* This is a auto generated file for building the project */--import * as sdk from "@webstudio-is/react-sdk";-import type { PageData } from "~/routes/_index";-import type { Components } from "@webstudio-is/react-sdk";-import type { Asset } from "@webstudio-is/sdk";-import {- Body as Body,- Heading as Heading,-} from "@webstudio-is/sdk-components-react";-import { Link as Link } from "@webstudio-is/sdk-components-react-remix";--export const components = new Map(- Object.entries({ Body: Body, Heading: Heading, Link: Link })-) as Components;-export const fontAssets: Asset[] = [];-export const pageData: PageData = {- build: {- props: [],- instances: [- [- "nEyRUCIYmfkBYUb-MSdDd",- {- type: "instance",- id: "nEyRUCIYmfkBYUb-MSdDd",- component: "Body",- children: [- { type: "id", value: "oX13CSOxZaPn94ukbUaW3" },- { type: "id", value: "M4cBN9R79h4ZxP8IlqmFp" },- ],- },- ],- [- "oX13CSOxZaPn94ukbUaW3",- {- type: "instance",- id: "oX13CSOxZaPn94ukbUaW3",- component: "Heading",- children: [{ type: "text", value: "Page" }],- },- ],- [- "M4cBN9R79h4ZxP8IlqmFp",- {- type: "instance",- id: "M4cBN9R79h4ZxP8IlqmFp",- component: "Link",- children: [{ type: "text", value: "Link text you can edit" }],- },- ],- ],- dataSources: [],- },- 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: "w9Qwfu1HOP397jLNtq-hc",- name: "Blog",- title: "Blog",- meta: { description: "" },- rootInstanceId: "xDnAIGJjaOVjOfMU6bbxQ",- path: "/blog",- },- {- id: "hd6G3bz113YtoxD-3lNAI",- name: "Page",- title: "Page",- meta: { description: "" },- rootInstanceId: "nEyRUCIYmfkBYUb-MSdDd",- path: "/blog/page",- },- {- id: "FGakc6C75caW7hRRn_0lZ",- name: "deep-nested-page",- title: "deep-nested-page",- meta: { description: "" },- rootInstanceId: "P_qm1M69qwe6M2aaNBzOH",- path: "/blog/page/deep-nested-page",- },- ],- page: {- id: "hd6G3bz113YtoxD-3lNAI",- name: "Page",- title: "Page",- meta: { description: "" },- rootInstanceId: "nEyRUCIYmfkBYUb-MSdDd",- path: "/blog/page",- },- assets: [- {- 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";--/* eslint-disable */--const indexesWithinAncestors = new Map<string, number>([]);--const rawExecuteComputingExpressions = (- _variables: Map<string, unknown>-): Map<string, unknown> => {- return new Map([]);-};-const executeComputingExpressions = (variables: Map<string, unknown>) => {- const encodedvariables = sdk.encodeVariablesMap(variables);- const encodedResult = rawExecuteComputingExpressions(encodedvariables);- return sdk.decodeVariablesMap(encodedResult);-};--const generatedEffectfulExpressions = new Map<- string,- (args: Map<string, any>, variables: Map<string, any>) => Map<string, unknown>->([]);--const rawExecuteEffectfulExpression = (- code: string,- args: Map<string, unknown>,- variables: Map<string, unknown>-): Map<string, unknown> => {- if (generatedEffectfulExpressions.has(code)) {- return generatedEffectfulExpressions.get(code)!(args, variables);- }- console.error("Effectful expression not found", code);- throw new Error("Effectful expression not found");-};--const executeEffectfulExpression = (- code: string,- args: Map<string, unknown>,- variables: Map<string, unknown>-) => {- const encodedvariables = sdk.encodeVariablesMap(variables);- const encodedResult = rawExecuteEffectfulExpression(- code,- args,- encodedvariables- );- return sdk.decodeVariablesMap(encodedResult);-};--export const utils = {- indexesWithinAncestors,- executeComputingExpressions,- executeEffectfulExpression,-};--/* eslint-enable */diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsxindex ca1cb392d8..0edf9561a0 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.tsx@@ -399,28 +399,12 @@ export const pageData: PageData = {path: "/radix",},{- id: "w9Qwfu1HOP397jLNtq-hc",- name: "Blog",- title: "Blog",+ id: "szYLvBduHPmbtqQKCDY0b",+ name: "RouteWithSymbols",+ title: "RouteWithSymbols",meta: { description: "" },- rootInstanceId: "xDnAIGJjaOVjOfMU6bbxQ",- path: "/blog",- },- {- id: "hd6G3bz113YtoxD-3lNAI",- name: "Page",- title: "Page",- meta: { description: "" },- rootInstanceId: "nEyRUCIYmfkBYUb-MSdDd",- path: "/blog/page",- },- {- id: "FGakc6C75caW7hRRn_0lZ",- name: "deep-nested-page",- title: "deep-nested-page",- meta: { description: "" },- rootInstanceId: "P_qm1M69qwe6M2aaNBzOH",- path: "/blog/page/deep-nested-page",+ rootInstanceId: "EDEfpMPRqDejthtwkH7ws",+ path: "/_route_with_symbols_",},],page: {@@ -432,6 +416,17 @@ export const pageData: PageData = {path: "/radix",},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",diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsxindex 6cc65ab753..3894de3da2 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/_index.tsx@@ -48,6 +48,16 @@ export const pageData: PageData = {value: "https://github.com/",},],+ [+ "tUn-hTQ0dKjsaRZ4q3m21",+ {+ id: "tUn-hTQ0dKjsaRZ4q3m21",+ instanceId: "9I4GRU1sev48hREkQcKQ-",+ name: "href",+ type: "page",+ value: "szYLvBduHPmbtqQKCDY0b",+ },+ ],],instances: [[@@ -98,6 +108,8 @@ export const pageData: PageData = {{ type: "id", value: "oLXYe1UQiVMhVnZGvJSMr" },{ type: "id", value: "p34JHWcU6UNrd9FVnY80Q" },{ type: "id", value: "l9AI_pShC-BH4ibxK6kNT" },+ { type: "id", value: "82HYqzxZeahPxSDFNWem5" },+ { type: "id", value: "9I4GRU1sev48hREkQcKQ-" },],},],@@ -154,6 +166,24 @@ export const pageData: PageData = {],},],+ [+ "9I4GRU1sev48hREkQcKQ-",+ {+ type: "instance",+ id: "9I4GRU1sev48hREkQcKQ-",+ component: "Link",+ children: [{ type: "text", value: "Symbols in path" }],+ },+ ],+ [+ "82HYqzxZeahPxSDFNWem5",+ {+ type: "instance",+ id: "82HYqzxZeahPxSDFNWem5",+ component: "Box",+ children: [],+ },+ ],],dataSources: [],},@@ -175,28 +205,12 @@ export const pageData: PageData = {path: "/radix",},{- id: "w9Qwfu1HOP397jLNtq-hc",- name: "Blog",- title: "Blog",- meta: { description: "" },- rootInstanceId: "xDnAIGJjaOVjOfMU6bbxQ",- path: "/blog",- },- {- id: "hd6G3bz113YtoxD-3lNAI",- name: "Page",- title: "Page",- meta: { description: "" },- rootInstanceId: "nEyRUCIYmfkBYUb-MSdDd",- path: "/blog/page",- },- {- id: "FGakc6C75caW7hRRn_0lZ",- name: "deep-nested-page",- title: "deep-nested-page",+ id: "szYLvBduHPmbtqQKCDY0b",+ name: "RouteWithSymbols",+ title: "RouteWithSymbols",meta: { description: "" },- rootInstanceId: "P_qm1M69qwe6M2aaNBzOH",- path: "/blog/page/deep-nested-page",+ rootInstanceId: "EDEfpMPRqDejthtwkH7ws",+ path: "/_route_with_symbols_",},],page: {@@ -208,6 +222,17 @@ export const pageData: PageData = {path: "",},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",diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/index.css b/fixtures/webstudio-remix-vercel/app/__generated__/index.cssindex 5e66a557e2..353d71e5e9 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/index.css+++ b/fixtures/webstudio-remix-vercel/app/__generated__/index.css@@ -1138,4 +1138,7 @@ html {line-height: 1.25rem;padding-bottom: 1rem;}+ [data-ws-id="AdXSAYCx4QDo5QN6nLoGs"] {+ aspect-ratio: 1;+ }}diff --git a/fixtures/webstudio-remix-vercel/app/routes/[blog].[page]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsxsimilarity index 98%rename from fixtures/webstudio-remix-vercel/app/routes/[blog].[page]._index.tsxrename to fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsxindex 278fda30ea..5201592f45 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[blog].[page]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx@@ -21,7 +21,7 @@ import {user,projectId,utils,-} from "../__generated__/[blog].[page]._index.tsx";+} from "../__generated__/[_route_with_symbols_]._index.tsx";import css from "../__generated__/index.css";import type { Data } from "@webstudio-is/http-client";import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.ts";diff --git a/fixtures/webstudio-remix-vercel/app/routes/[blog].[page].[deep-nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[blog].[page].[deep-nested-page]._index.tsxdeleted file mode 100644index 2b040827ef..0000000000--- a/fixtures/webstudio-remix-vercel/app/routes/[blog].[page].[deep-nested-page]._index.tsx+++ /dev/null@@ -1,180 +0,0 @@-/* eslint-disable camelcase */-import {- type V2_MetaFunction,- type LinksFunction,- type LinkDescriptor,- type ActionArgs,- json,-} from "@remix-run/node";--import {- InstanceRoot,- type RootPropsData,- type Params,-} from "@webstudio-is/react-sdk";-import { n8nHandler, getFormProperties } from "@webstudio-is/form-handlers";-import { Scripts, ScrollRestoration } from "@remix-run/react";-import {- fontAssets,- components,- pageData,- user,- projectId,- utils,-} from "../__generated__/[blog].[page].[deep-nested-page]._index.tsx";-import css from "../__generated__/index.css";-import type { Data } from "@webstudio-is/http-client";-import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.ts";--export type PageData = Omit<Data, "build"> & {- build: Pick<Data["build"], "props" | "instances" | "dataSources">;-};--export const meta: V2_MetaFunction = () => {- const { page } = pageData;- return [{ title: page?.title || "Webstudio", ...page?.meta }];-};--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 formProperties = getFormProperties(formData, pageData.build.props);-- if (formProperties === 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 { 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 pagesCanvasData: PageData = pageData;-- const page = pagesCanvasData.page;-- if (page === undefined) {- throw json("Page not found", {- status: 404,- });- }-- const params: Params = {- assetBaseUrl,- imageBaseUrl,- };-- const data: RootPropsData = {- build: pagesCanvasData.build,- assets: pagesCanvasData.assets,- page,- pages: pagesCanvasData.pages,- params,- };-- return (- <InstanceRoot- imageLoader={imageLoader}- data={data}- components={components}- utils={utils}- scripts={- <>- <Scripts />- <ScrollRestoration />- </>- }- />- );-};--export default Outlet;diff --git a/fixtures/webstudio-remix-vercel/app/routes/[blog]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[blog]._index.tsxdeleted file mode 100644index 02c3f192ff..0000000000--- a/fixtures/webstudio-remix-vercel/app/routes/[blog]._index.tsx+++ /dev/null@@ -1,180 +0,0 @@-/* eslint-disable camelcase */-import {- type V2_MetaFunction,- type LinksFunction,- type LinkDescriptor,- type ActionArgs,- json,-} from "@remix-run/node";--import {- InstanceRoot,- type RootPropsData,- type Params,-} from "@webstudio-is/react-sdk";-import { n8nHandler, getFormProperties } from "@webstudio-is/form-handlers";-import { Scripts, ScrollRestoration } from "@remix-run/react";-import {- fontAssets,- components,- pageData,- user,- projectId,- utils,-} from "../__generated__/[blog]._index.tsx";-import css from "../__generated__/index.css";-import type { Data } from "@webstudio-is/http-client";-import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.ts";--export type PageData = Omit<Data, "build"> & {- build: Pick<Data["build"], "props" | "instances" | "dataSources">;-};--export const meta: V2_MetaFunction = () => {- const { page } = pageData;- return [{ title: page?.title || "Webstudio", ...page?.meta }];-};--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 formProperties = getFormProperties(formData, pageData.build.props);-- if (formProperties === 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 { 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 pagesCanvasData: PageData = pageData;-- const page = pagesCanvasData.page;-- if (page === undefined) {- throw json("Page not found", {- status: 404,- });- }-- const params: Params = {- assetBaseUrl,- imageBaseUrl,- };-- const data: RootPropsData = {- build: pagesCanvasData.build,- assets: pagesCanvasData.assets,- page,- pages: pagesCanvasData.pages,- params,- };-- return (- <InstanceRoot- imageLoader={imageLoader}- data={data}- components={components}- utils={utils}- scripts={- <>- <Scripts />- <ScrollRestoration />- </>- }- />- );-};--export default Outlet;diff --git a/fixtures/webstudio-remix-vercel/public/assets/_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg b/fixtures/webstudio-remix-vercel/public/assets/_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpegindex ba43ae9a7a..1c8219b73b 100644Binary files a/fixtures/webstudio-remix-vercel/public/assets/_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg and b/fixtures/webstudio-remix-vercel/public/assets/_937084ed-a798-49fe-8664-df93a2af605e_uiBk3o6UWdqolyakMvQJ9.jpeg differdiff --git a/fixtures/webstudio-remix-vercel/public/assets/small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp b/fixtures/webstudio-remix-vercel/public/assets/small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webpnew file mode 100644index 0000000000..dcb31617dcBinary files /dev/null and b/fixtures/webstudio-remix-vercel/public/assets/small-avif-kitty_FnabJsioMWpBtXZSGf4DR.webp differdiff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.tsindex 31f89e9e81..865b61aeea 100644--- a/packages/cli/src/prebuild.ts+++ b/packages/cli/src/prebuild.ts@@ -42,7 +42,7 @@ import {parseFolderAndWriteFiles,parseFolderAndWriteAssets,} from "./fs-utils";-import { getImageAttributes, createImageLoader } from "@webstudio-is/image";+import { createImageLoader } from "@webstudio-is/image";const limit = pLimit(10);@@ -244,32 +244,22 @@ export const prebuild = async (options: {const appDomain = options.preview ? "wstd.work" : "wstd.io";const assetBuildUrl = `https://${domain}.${appDomain}/cgi/asset/`;+ const imageLoader = createImageLoader({+ imageBaseUrl: assetBuildUrl,+ });+for (const asset of siteData.assets) {if (asset.type === "image") {- const image = getImageAttributes({- /*- TODO:- https://github.com/webstudio-is/webstudio/issues/2135- There should be a option in the loader, that allows to download- original image instead of the processed one. Right now, we are using- the width from the asset meta- */- width: asset.meta.width,- optimize: true,- src: asset.name,+ const imageSrc = imageLoader({+ width: 1,quality: 100,- srcSet: undefined,- sizes: undefined,- loader: createImageLoader({- imageBaseUrl: assetBuildUrl,- }),+ src: asset.name,+ format: "raw",});- if (image?.src) {- assetsToDownload.push(- limit(() => downloadAsset(image.src, asset.name, temporaryDir))- );- }+ assetsToDownload.push(+ limit(() => downloadAsset(imageSrc, asset.name, temporaryDir))+ );}if (asset.type === "font") {diff --git a/packages/image/src/image-loaders.ts b/packages/image/src/image-loaders.tsindex 2520b8656b..91db805498 100644--- a/packages/image/src/image-loaders.ts+++ b/packages/image/src/image-loaders.ts@@ -11,7 +11,7 @@ export type ImageLoaderOptions = {**/export const createImageLoader =(loaderOptions: ImageLoaderOptions): ImageLoader =>- ({ width, src, quality }) => {+ ({ width, src, quality, format }) => {if (process.env.NODE_ENV !== "production") {warnOnce(allSizes.includes(width) === false,@@ -22,7 +22,7 @@ export const createImageLoader =const searchParams = new URLSearchParams();searchParams.set("width", width.toString());searchParams.set("quality", quality.toString());- searchParams.set("format", "auto");+ searchParams.set("format", format ?? "auto");// Cloudflare docs say that we don't need to urlencode the path paramsreturn `${imageBaseUrl}${src}?${searchParams.toString()}`;diff --git a/packages/image/src/image-optimize.ts b/packages/image/src/image-optimize.tsindex 2477f1f426..9137a99679 100644--- a/packages/image/src/image-optimize.ts+++ b/packages/image/src/image-optimize.ts@@ -90,6 +90,7 @@ export type ImageLoader = (props: {width: number;quality: number;src: string;+ format?: "auto" | "raw";}) => string;/**