webstudio 0.143.0 → 0.144.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +37 -45
- package/package.json +11 -11
- package/templates/defaults/__templates__/route-template.tsx +21 -27
- package/templates/defaults/app/root.tsx +17 -1
- package/templates/defaults/app/routes/[robots.txt].tsx +2 -2
- package/templates/defaults/app/routes/[sitemap.xml].tsx +2 -2
- package/templates/defaults/{remix.env.d.ts → env.d.ts} +1 -1
- package/templates/defaults/package.json +16 -15
- package/templates/defaults/tsconfig.json +2 -1
- package/templates/defaults/vite.config.ts +15 -0
- package/templates/internal/package.json +11 -0
- package/templates/netlify-edge-functions/netlify.toml +11 -2
- package/templates/netlify-edge-functions/package.json +2 -4
- package/templates/netlify-edge-functions/vite.config.ts +16 -0
- package/templates/netlify-functions/app/entry.server.tsx +1 -21
- package/templates/netlify-functions/netlify.toml +7 -5
- package/templates/netlify-functions/package.json +2 -3
- package/templates/netlify-functions/vite.config.ts +16 -0
- package/templates/vercel/package.json +1 -5
- package/templates/defaults/remix.config.js +0 -19
- package/templates/netlify-edge-functions/remix.config.js +0 -28
- package/templates/netlify-edge-functions/server.js +0 -19
- package/templates/netlify-functions/_app_redirects +0 -9
- package/templates/netlify-functions/remix.config.js +0 -30
- package/templates/netlify-functions/server.js +0 -7
package/lib/cli.js
CHANGED
|
@@ -306,7 +306,7 @@ var downloadAsset = async (url, name, assetBaseUrl) => {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
|
-
var
|
|
309
|
+
var mergeJsonInto = async (sourcePath, destinationPath) => {
|
|
310
310
|
const sourceJson = await readFile4(sourcePath, "utf8");
|
|
311
311
|
const destinationJson = await readFile4(destinationPath, "utf8").catch(
|
|
312
312
|
(error) => {
|
|
@@ -317,7 +317,7 @@ var mergeJsonFiles = async (sourcePath, destinationPath) => {
|
|
|
317
317
|
}
|
|
318
318
|
);
|
|
319
319
|
const content = JSON.stringify(
|
|
320
|
-
merge(JSON.parse(
|
|
320
|
+
merge(JSON.parse(destinationJson), JSON.parse(sourceJson)),
|
|
321
321
|
null,
|
|
322
322
|
" "
|
|
323
323
|
);
|
|
@@ -350,7 +350,7 @@ var copyTemplates = async (template = "defaults") => {
|
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
352
|
if (await isFileExists(join4(templatePath, "package.json")) === true) {
|
|
353
|
-
await
|
|
353
|
+
await mergeJsonInto(
|
|
354
354
|
join4(templatePath, "package.json"),
|
|
355
355
|
join4(cwd3(), "package.json")
|
|
356
356
|
);
|
|
@@ -514,12 +514,6 @@ var prebuild = async (options) => {
|
|
|
514
514
|
backgroundImageAssetsByPage[page.id] = backgroundImageAssets;
|
|
515
515
|
}
|
|
516
516
|
const assetsToDownload = [];
|
|
517
|
-
const imageAssets = [];
|
|
518
|
-
for (const asset of siteData.assets) {
|
|
519
|
-
if (asset.type === "image") {
|
|
520
|
-
imageAssets.push(asset);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
517
|
const appDomain = options.preview ? "wstd.work" : "wstd.io";
|
|
524
518
|
const assetBuildUrl = `https://${domain}.${appDomain}/cgi/asset/`;
|
|
525
519
|
const imageLoader = createImageLoader({
|
|
@@ -549,21 +543,18 @@ var prebuild = async (options) => {
|
|
|
549
543
|
}
|
|
550
544
|
}
|
|
551
545
|
}
|
|
546
|
+
const assets = new Map(siteData.assets.map((asset) => [asset.id, asset]));
|
|
552
547
|
spinner.text = "Generating css file";
|
|
553
|
-
const { cssText, classesMap } = generateCss(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
assetBaseUrl,
|
|
564
|
-
atomic: siteData.build.pages.compiler?.atomicStyles ?? true
|
|
565
|
-
}
|
|
566
|
-
);
|
|
548
|
+
const { cssText, classesMap } = generateCss({
|
|
549
|
+
assets,
|
|
550
|
+
breakpoints: new Map(siteData.build?.breakpoints),
|
|
551
|
+
styles: new Map(siteData.build?.styles),
|
|
552
|
+
styleSourceSelections: new Map(siteData.build?.styleSourceSelections),
|
|
553
|
+
// pass only used metas to not generate unused preset styles
|
|
554
|
+
componentMetas: projectMetas,
|
|
555
|
+
assetBaseUrl,
|
|
556
|
+
atomic: siteData.build.pages.compiler?.atomicStyles ?? true
|
|
557
|
+
});
|
|
567
558
|
await ensureFileInPath(join4(generatedDir, "index.css"), cssText);
|
|
568
559
|
spinner.text = "Generating routes and pages";
|
|
569
560
|
const routeTemplatePath = normalize(
|
|
@@ -641,9 +632,10 @@ var prebuild = async (options) => {
|
|
|
641
632
|
[rootInstanceId]
|
|
642
633
|
)
|
|
643
634
|
});
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
);
|
|
635
|
+
const projectMeta = siteData.build.pages.meta;
|
|
636
|
+
const pageMeta = pageData.page.meta;
|
|
637
|
+
const favIconAsset = assets.get(projectMeta?.faviconAssetId ?? "");
|
|
638
|
+
const socialImageAsset = assets.get(pageMeta.socialImageAssetId ?? "");
|
|
647
639
|
const pageExports = `/* eslint-disable */
|
|
648
640
|
/* This is a auto generated file for building the project */
|
|
649
641
|
|
|
@@ -652,14 +644,19 @@ import { Fragment, useState } from "react";
|
|
|
652
644
|
import type { FontAsset, ImageAsset } from "@webstudio-is/sdk";
|
|
653
645
|
import { useResource } from "@webstudio-is/react-sdk";
|
|
654
646
|
${componentImports}
|
|
655
|
-
|
|
647
|
+
|
|
648
|
+
export const favIconAsset: ImageAsset | undefined =
|
|
649
|
+
${JSON.stringify(favIconAsset)};
|
|
650
|
+
|
|
651
|
+
export const socialImageAsset: ImageAsset | undefined =
|
|
652
|
+
${JSON.stringify(socialImageAsset)};
|
|
656
653
|
|
|
657
654
|
// Font assets on current page (can be preloaded)
|
|
658
|
-
export const pageFontAssets: FontAsset[] =
|
|
655
|
+
export const pageFontAssets: FontAsset[] =
|
|
656
|
+
${JSON.stringify(pageFontAssets)}
|
|
659
657
|
|
|
660
|
-
export const pageBackgroundImageAssets: ImageAsset[] =
|
|
661
|
-
|
|
662
|
-
)}
|
|
658
|
+
export const pageBackgroundImageAssets: ImageAsset[] =
|
|
659
|
+
${JSON.stringify(pageBackgroundImageAssets)}
|
|
663
660
|
|
|
664
661
|
|
|
665
662
|
|
|
@@ -671,7 +668,7 @@ export { Page }
|
|
|
671
668
|
/* This is a auto generated file for building the project */
|
|
672
669
|
|
|
673
670
|
|
|
674
|
-
import type {
|
|
671
|
+
import type { ProjectMeta, PageMeta } from "@webstudio-is/sdk";
|
|
675
672
|
${generateResourcesLoader({
|
|
676
673
|
scope,
|
|
677
674
|
page: pageData.page,
|
|
@@ -691,16 +688,11 @@ ${generateRemixParams(pageData.page.path)}
|
|
|
691
688
|
|
|
692
689
|
export const projectId = "${siteData.build.projectId}";
|
|
693
690
|
|
|
694
|
-
export const user: { email: string | null } | undefined =
|
|
695
|
-
|
|
696
|
-
)};
|
|
697
|
-
|
|
698
|
-
export const projectMeta: ProjectMeta = ${JSON.stringify(
|
|
699
|
-
siteData.build.pages.meta
|
|
700
|
-
)};
|
|
701
|
-
|
|
702
|
-
export const imageAssets: ImageAsset[] = ${JSON.stringify(imageAssets)}
|
|
691
|
+
export const user: { email: string | null } | undefined =
|
|
692
|
+
${JSON.stringify(siteData.user)};
|
|
703
693
|
|
|
694
|
+
export const projectMeta: ProjectMeta =
|
|
695
|
+
${JSON.stringify(projectMeta)};
|
|
704
696
|
`;
|
|
705
697
|
const pagePath = getPagePath(pageData.page.id, siteData.build.pages);
|
|
706
698
|
const remixRoute = generateRemixRoute(pagePath);
|
|
@@ -742,9 +734,9 @@ export const imageAssets: ImageAsset[] = ${JSON.stringify(imageAssets)}
|
|
|
742
734
|
for (const redirect of redirects) {
|
|
743
735
|
const redirectPagePath = generateRemixRoute(redirect.old);
|
|
744
736
|
const redirectFileName = `${redirectPagePath}.ts`;
|
|
745
|
-
const content = `import { type
|
|
737
|
+
const content = `import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
|
|
746
738
|
|
|
747
|
-
export const loader = (arg:
|
|
739
|
+
export const loader = (arg: LoaderFunctionArgs) => {
|
|
748
740
|
return redirect("${redirect.new}", ${redirect.status ?? 301});
|
|
749
741
|
};
|
|
750
742
|
`;
|
|
@@ -925,7 +917,7 @@ import makeCLI from "yargs";
|
|
|
925
917
|
// package.json
|
|
926
918
|
var package_default = {
|
|
927
919
|
name: "webstudio",
|
|
928
|
-
version: "0.
|
|
920
|
+
version: "0.144.0",
|
|
929
921
|
description: "Webstudio CLI",
|
|
930
922
|
author: "Webstudio <github@webstudio.is>",
|
|
931
923
|
homepage: "https://webstudio.is",
|
|
@@ -973,7 +965,7 @@ var package_default = {
|
|
|
973
965
|
"@types/prompts": "^2.4.5",
|
|
974
966
|
"@webstudio-is/form-handlers": "workspace:*",
|
|
975
967
|
"@webstudio-is/tsconfig": "workspace:*",
|
|
976
|
-
tsx: "^
|
|
968
|
+
tsx: "^4.7.2",
|
|
977
969
|
typescript: "5.2.2"
|
|
978
970
|
}
|
|
979
971
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webstudio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.144.0",
|
|
4
4
|
"description": "Webstudio CLI",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
"title-case": "^4.1.0",
|
|
29
29
|
"yargs": "^17.7.2",
|
|
30
30
|
"zod": "^3.22.4",
|
|
31
|
-
"@webstudio-is/http-client": "0.
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/
|
|
34
|
-
"@webstudio-is/sdk": "0.
|
|
35
|
-
"@webstudio-is/sdk-components-react
|
|
36
|
-
"@webstudio-is/sdk-components-react-remix": "0.
|
|
37
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
31
|
+
"@webstudio-is/http-client": "0.144.0",
|
|
32
|
+
"@webstudio-is/react-sdk": "0.144.0",
|
|
33
|
+
"@webstudio-is/image": "0.144.0",
|
|
34
|
+
"@webstudio-is/sdk": "0.144.0",
|
|
35
|
+
"@webstudio-is/sdk-components-react": "0.144.0",
|
|
36
|
+
"@webstudio-is/sdk-components-react-remix": "0.144.0",
|
|
37
|
+
"@webstudio-is/sdk-components-react-radix": "0.144.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^18.17.1",
|
|
41
41
|
"@types/prompts": "^2.4.5",
|
|
42
|
-
"tsx": "^
|
|
42
|
+
"tsx": "^4.7.2",
|
|
43
43
|
"typescript": "5.2.2",
|
|
44
|
-
"@webstudio-is/
|
|
45
|
-
"@webstudio-is/
|
|
44
|
+
"@webstudio-is/form-handlers": "0.144.0",
|
|
45
|
+
"@webstudio-is/tsconfig": "1.0.7"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"typecheck": "tsc",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import {
|
|
3
|
-
type
|
|
3
|
+
type ServerRuntimeMetaFunction as MetaFunction,
|
|
4
4
|
type LinksFunction,
|
|
5
5
|
type LinkDescriptor,
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type
|
|
6
|
+
type ActionFunctionArgs,
|
|
7
|
+
type LoaderFunctionArgs,
|
|
8
|
+
type HeadersFunction,
|
|
9
9
|
json,
|
|
10
10
|
redirect,
|
|
11
11
|
} from "@remix-run/server-runtime";
|
|
@@ -15,6 +15,7 @@ import { n8nHandler, getFormId } from "@webstudio-is/form-handlers";
|
|
|
15
15
|
import {
|
|
16
16
|
Page,
|
|
17
17
|
favIconAsset,
|
|
18
|
+
socialImageAsset,
|
|
18
19
|
pageFontAssets,
|
|
19
20
|
pageBackgroundImageAssets,
|
|
20
21
|
} from "../../../__generated__/_index";
|
|
@@ -26,13 +27,12 @@ import {
|
|
|
26
27
|
projectId,
|
|
27
28
|
user,
|
|
28
29
|
projectMeta,
|
|
29
|
-
imageAssets,
|
|
30
30
|
} from "../../../__generated__/_index.server";
|
|
31
31
|
|
|
32
|
-
import css from "../__generated__/index.css";
|
|
32
|
+
import css from "../__generated__/index.css?url";
|
|
33
33
|
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
|
|
34
34
|
|
|
35
|
-
export const loader = async (arg:
|
|
35
|
+
export const loader = async (arg: LoaderFunctionArgs) => {
|
|
36
36
|
const url = new URL(arg.request.url);
|
|
37
37
|
const params = getRemixParams(arg.params);
|
|
38
38
|
const system = {
|
|
@@ -83,15 +83,15 @@ export const loader = async (arg: LoaderArgs) => {
|
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
export const headers = ({ loaderHeaders }
|
|
86
|
+
export const headers: HeadersFunction = ({ loaderHeaders }) => {
|
|
87
87
|
return {
|
|
88
88
|
"Cache-Control": "public, max-age=0, must-revalidate",
|
|
89
|
-
"x-ws-language": loaderHeaders.get("x-ws-language"),
|
|
89
|
+
"x-ws-language": loaderHeaders.get("x-ws-language") ?? "",
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
export const meta:
|
|
94
|
-
const metas: ReturnType<
|
|
93
|
+
export const meta: MetaFunction<typeof loader> = ({ data }) => {
|
|
94
|
+
const metas: ReturnType<MetaFunction> = [];
|
|
95
95
|
if (data === undefined) {
|
|
96
96
|
return metas;
|
|
97
97
|
}
|
|
@@ -150,21 +150,15 @@ export const meta: V2_ServerRuntimeMetaFunction<typeof loader> = ({ data }) => {
|
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
src: imageAsset.name,
|
|
163
|
-
// Do not transform social image (not enough information do we need to do this)
|
|
164
|
-
format: "raw",
|
|
165
|
-
})}`,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
153
|
+
if (socialImageAsset) {
|
|
154
|
+
metas.push({
|
|
155
|
+
property: "og:image",
|
|
156
|
+
content: `https://${data.host}${imageLoader({
|
|
157
|
+
src: socialImageAsset.name,
|
|
158
|
+
// Do not transform social image (not enough information do we need to do this)
|
|
159
|
+
format: "raw",
|
|
160
|
+
})}`,
|
|
161
|
+
});
|
|
168
162
|
} else if (pageMeta.socialImageUrl) {
|
|
169
163
|
metas.push({
|
|
170
164
|
property: "og:image",
|
|
@@ -246,7 +240,7 @@ const getMethod = (value: string | undefined) => {
|
|
|
246
240
|
}
|
|
247
241
|
};
|
|
248
242
|
|
|
249
|
-
export const action = async ({ request, context }:
|
|
243
|
+
export const action = async ({ request, context }: ActionFunctionArgs) => {
|
|
250
244
|
const formData = await request.formData();
|
|
251
245
|
|
|
252
246
|
const formId = getFormId(formData);
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { Links, Meta, Outlet } from "@remix-run/react";
|
|
2
|
+
|
|
3
|
+
const Root = () => {
|
|
4
|
+
return (
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charSet="utf-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
9
|
+
<Meta />
|
|
10
|
+
<Links />
|
|
11
|
+
</head>
|
|
12
|
+
<Outlet />
|
|
13
|
+
</html>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Root;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
|
|
2
2
|
|
|
3
|
-
export const loader = (arg:
|
|
3
|
+
export const loader = (arg: LoaderFunctionArgs) => {
|
|
4
4
|
const host =
|
|
5
5
|
arg.request.headers.get("x-forwarded-host") ||
|
|
6
6
|
arg.request.headers.get("host") ||
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
|
|
2
2
|
import { sitemap } from "../__generated__/[sitemap.xml]";
|
|
3
3
|
|
|
4
|
-
export const loader = (arg:
|
|
4
|
+
export const loader = (arg: LoaderFunctionArgs) => {
|
|
5
5
|
const host =
|
|
6
6
|
arg.request.headers.get("x-forwarded-host") ||
|
|
7
7
|
arg.request.headers.get("host") ||
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
2
|
/// <reference types="@remix-run/node" />
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
+
"type": "module",
|
|
2
3
|
"private": true,
|
|
3
4
|
"sideEffects": false,
|
|
4
5
|
"scripts": {
|
|
5
|
-
"build": "remix build",
|
|
6
|
-
"dev": "remix dev",
|
|
6
|
+
"build": "remix vite:build",
|
|
7
|
+
"dev": "remix vite:dev",
|
|
7
8
|
"typecheck": "tsc"
|
|
8
9
|
},
|
|
9
10
|
"dependencies": {
|
|
10
|
-
"@remix-run/react": "^
|
|
11
|
-
"@remix-run/server-runtime": "^
|
|
12
|
-
"@remix-run/node": "^
|
|
13
|
-
"@webstudio-is/react-sdk": "0.
|
|
14
|
-
"@webstudio-is/sdk-components-react-radix": "0.
|
|
15
|
-
"@webstudio-is/sdk-components-react-remix": "0.
|
|
16
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
17
|
-
"@webstudio-is/form-handlers": "0.
|
|
18
|
-
"@webstudio-is/image": "0.
|
|
19
|
-
"@webstudio-is/sdk": "0.
|
|
11
|
+
"@remix-run/react": "^2.8.1",
|
|
12
|
+
"@remix-run/server-runtime": "^2.8.1",
|
|
13
|
+
"@remix-run/node": "^2.8.1",
|
|
14
|
+
"@webstudio-is/react-sdk": "0.144.0",
|
|
15
|
+
"@webstudio-is/sdk-components-react-radix": "0.144.0",
|
|
16
|
+
"@webstudio-is/sdk-components-react-remix": "0.144.0",
|
|
17
|
+
"@webstudio-is/sdk-components-react": "0.144.0",
|
|
18
|
+
"@webstudio-is/form-handlers": "0.144.0",
|
|
19
|
+
"@webstudio-is/image": "0.144.0",
|
|
20
|
+
"@webstudio-is/sdk": "0.144.0",
|
|
20
21
|
"isbot": "^3.6.8",
|
|
21
22
|
"react": "^18.2.0",
|
|
22
23
|
"react-dom": "^18.2.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@remix-run/
|
|
26
|
-
"@remix-run/dev": "^1.19.2",
|
|
26
|
+
"@remix-run/dev": "^2.8.1",
|
|
27
27
|
"@types/react": "^18.2.20",
|
|
28
28
|
"@types/react-dom": "^18.2.7",
|
|
29
|
-
"typescript": "5.2.2"
|
|
29
|
+
"typescript": "5.2.2",
|
|
30
|
+
"vite": "^5.2.8"
|
|
30
31
|
},
|
|
31
32
|
"engines": {
|
|
32
33
|
"node": ">=18.0.0"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"include": ["
|
|
2
|
+
"include": ["env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs"],
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
5
5
|
"isolatedModules": true,
|
|
6
6
|
"esModuleInterop": true,
|
|
7
7
|
"jsx": "react-jsx",
|
|
8
|
+
"module": "ESNext",
|
|
8
9
|
"moduleResolution": "bundler",
|
|
9
10
|
"resolveJsonModule": true,
|
|
10
11
|
"target": "ES2022",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import { vitePlugin as remix } from "@remix-run/dev";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [remix()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: [
|
|
9
|
+
{
|
|
10
|
+
find: "~",
|
|
11
|
+
replacement: resolve("app"),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"@webstudio-is/react-sdk": "workspace:*",
|
|
4
|
+
"@webstudio-is/sdk-components-react-radix": "workspace:*",
|
|
5
|
+
"@webstudio-is/sdk-components-react-remix": "workspace:*",
|
|
6
|
+
"@webstudio-is/sdk-components-react": "workspace:*",
|
|
7
|
+
"@webstudio-is/form-handlers": "workspace:*",
|
|
8
|
+
"@webstudio-is/image": "workspace:*",
|
|
9
|
+
"@webstudio-is/sdk": "workspace:*"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
[build]
|
|
2
2
|
command = "npm run build"
|
|
3
|
-
publish = "
|
|
3
|
+
publish = "build/client"
|
|
4
4
|
|
|
5
5
|
[dev]
|
|
6
6
|
command = "npm run dev"
|
|
7
|
-
|
|
7
|
+
framework = "vite"
|
|
8
|
+
|
|
9
|
+
# Set immutable caching for static files, because they have fingerprinted filenames
|
|
10
|
+
|
|
11
|
+
[[headers]]
|
|
12
|
+
for = "/build/*"
|
|
13
|
+
|
|
14
|
+
[headers.values]
|
|
15
|
+
|
|
16
|
+
"Cache-Control" = "public, max-age=31560000, immutable"
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"scripts": {
|
|
3
|
-
"predev": "node -e \"fs.rmSync('./public/_redirects', { recursive: true, force: true })\"",
|
|
4
3
|
"start": "netlify serve"
|
|
5
4
|
},
|
|
6
5
|
"dependencies": {
|
|
7
|
-
"@netlify/functions": "^
|
|
8
|
-
"@netlify/edge-
|
|
9
|
-
"@netlify/remix-edge-adapter": "1.2.0"
|
|
6
|
+
"@netlify/edge-functions": "^2.3.1",
|
|
7
|
+
"@netlify/remix-edge-adapter": "3.2.0"
|
|
10
8
|
}
|
|
11
9
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { vitePlugin as remix } from "@remix-run/dev";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
import { netlifyPlugin } from "@netlify/remix-edge-adapter/plugin";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [remix(), netlifyPlugin()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: [
|
|
10
|
+
{
|
|
11
|
+
find: "~",
|
|
12
|
+
replacement: resolve("app"),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { RemixServer } from "@remix-run/react";
|
|
3
|
-
import { renderToString } from "react-dom/server";
|
|
4
|
-
|
|
5
|
-
export default function handleRequest(
|
|
6
|
-
request: Request,
|
|
7
|
-
responseStatusCode: number,
|
|
8
|
-
responseHeaders: Headers,
|
|
9
|
-
remixContext: EntryContext
|
|
10
|
-
) {
|
|
11
|
-
const markup = renderToString(
|
|
12
|
-
<RemixServer context={remixContext} url={request.url} />
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
responseHeaders.set("Content-Type", "text/html");
|
|
16
|
-
|
|
17
|
-
return new Response("<!DOCTYPE html>" + markup, {
|
|
18
|
-
headers: responseHeaders,
|
|
19
|
-
status: responseStatusCode,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
1
|
+
export { handleRequest as default } from "@netlify/remix-adapter";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
[build]
|
|
2
|
-
command = "
|
|
3
|
-
publish = "
|
|
2
|
+
command = "npm run build"
|
|
3
|
+
publish = "build/client"
|
|
4
4
|
|
|
5
5
|
[dev]
|
|
6
6
|
command = "npm run dev"
|
|
7
|
-
|
|
7
|
+
framework = "vite"
|
|
8
|
+
|
|
9
|
+
# Set immutable caching for static files, because they have fingerprinted filenames
|
|
8
10
|
|
|
9
11
|
[[headers]]
|
|
10
12
|
for = "/build/*"
|
|
11
13
|
|
|
12
14
|
[headers.values]
|
|
13
|
-
|
|
14
|
-
"Cache-Control" = "public, max-age=
|
|
15
|
+
|
|
16
|
+
"Cache-Control" = "public, max-age=31560000, immutable"
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"scripts": {
|
|
3
|
-
"predev": "node -e \"fs.rmSync('./public/_redirects', { recursive: true, force: true })\"",
|
|
4
3
|
"start": "netlify serve"
|
|
5
4
|
},
|
|
6
5
|
"dependencies": {
|
|
7
|
-
"@netlify/functions": "^
|
|
8
|
-
"@netlify/remix-adapter": "^
|
|
6
|
+
"@netlify/functions": "^2.6.0",
|
|
7
|
+
"@netlify/remix-adapter": "^2.3.0"
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { vitePlugin as remix } from "@remix-run/dev";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
import { netlifyPlugin } from "@netlify/remix-adapter/plugin";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [remix(), netlifyPlugin()],
|
|
8
|
+
resolve: {
|
|
9
|
+
alias: [
|
|
10
|
+
{
|
|
11
|
+
find: "~",
|
|
12
|
+
replacement: resolve("app"),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** @type {import('@remix-run/dev').AppConfig} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
ignoredRouteFiles: ["**/.*"],
|
|
4
|
-
serverModuleFormat: "cjs",
|
|
5
|
-
serverDependenciesToBundle: [
|
|
6
|
-
/@webstudio-is\//,
|
|
7
|
-
"nanoid",
|
|
8
|
-
"change-case",
|
|
9
|
-
"title-case",
|
|
10
|
-
],
|
|
11
|
-
future: {
|
|
12
|
-
v2_errorBoundary: true,
|
|
13
|
-
v2_headers: true,
|
|
14
|
-
v2_meta: true,
|
|
15
|
-
v2_normalizeFormMethod: true,
|
|
16
|
-
v2_routeConvention: true,
|
|
17
|
-
v2_dev: true,
|
|
18
|
-
},
|
|
19
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { config } = require("@netlify/remix-edge-adapter");
|
|
2
|
-
const baseConfig =
|
|
3
|
-
process.env.NODE_ENV === "production"
|
|
4
|
-
? config
|
|
5
|
-
: {
|
|
6
|
-
ignoredRouteFiles: ["**/.*"],
|
|
7
|
-
serverModuleFormat: "cjs",
|
|
8
|
-
serverDependenciesToBundle: [
|
|
9
|
-
/@webstudio-is\//,
|
|
10
|
-
"nanoid",
|
|
11
|
-
"change-case",
|
|
12
|
-
"title-case",
|
|
13
|
-
],
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/** @type {import('@remix-run/dev').AppConfig} */
|
|
17
|
-
module.exports = {
|
|
18
|
-
ignoredRouteFiles: ["**/.*"],
|
|
19
|
-
...baseConfig,
|
|
20
|
-
future: {
|
|
21
|
-
v2_errorBoundary: true,
|
|
22
|
-
v2_headers: true,
|
|
23
|
-
v2_meta: true,
|
|
24
|
-
v2_normalizeFormMethod: true,
|
|
25
|
-
v2_routeConvention: true,
|
|
26
|
-
v2_dev: true,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Import path interpreted by the Remix compiler
|
|
2
|
-
import * as build from "@remix-run/dev/server-build";
|
|
3
|
-
import { createRequestHandler } from "@netlify/remix-edge-adapter";
|
|
4
|
-
|
|
5
|
-
export default createRequestHandler({
|
|
6
|
-
build,
|
|
7
|
-
// process.env.NODE_ENV is provided by Remix at compile time
|
|
8
|
-
mode: process.env.NODE_ENV,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const config = {
|
|
12
|
-
cache: "manual",
|
|
13
|
-
path: "/*",
|
|
14
|
-
// Let the CDN handle requests for static assets, i.e. ^/_assets/*$
|
|
15
|
-
//
|
|
16
|
-
// Add other exclusions here, e.g. "^/api/*$" for custom Netlify functions or
|
|
17
|
-
// custom Netlify Edge Functions
|
|
18
|
-
excluded_patterns: ["^/_assets/*$"],
|
|
19
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# This template uses this file instead of the typicial Netlify \_redirects file.
|
|
2
|
-
|
|
3
|
-
# For more information about redirects and rewrites, see https://docs.netlify.com/routing/redirects/.
|
|
4
|
-
|
|
5
|
-
# Do not remove the line below. This is required to serve the project when deployed.
|
|
6
|
-
|
|
7
|
-
/\* /.netlify/functions/server 200
|
|
8
|
-
|
|
9
|
-
# Add other redirects and rewrites here and/or in your netlify.toml
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const baseConfig =
|
|
2
|
-
process.env.NODE_ENV === "production"
|
|
3
|
-
? // when running the Netify CLI or building on Netlify, we want to use
|
|
4
|
-
{
|
|
5
|
-
server: "./server.js",
|
|
6
|
-
serverBuildPath: ".netlify/functions-internal/server.js",
|
|
7
|
-
}
|
|
8
|
-
: // otherwise support running remix dev, i.e. no custom server
|
|
9
|
-
undefined;
|
|
10
|
-
|
|
11
|
-
/** @type {import('@remix-run/dev').AppConfig} */
|
|
12
|
-
module.exports = {
|
|
13
|
-
...baseConfig,
|
|
14
|
-
ignoredRouteFiles: ["**/.*"],
|
|
15
|
-
serverModuleFormat: "cjs",
|
|
16
|
-
serverDependenciesToBundle: [
|
|
17
|
-
/@webstudio-is\//,
|
|
18
|
-
"nanoid",
|
|
19
|
-
"change-case",
|
|
20
|
-
"title-case",
|
|
21
|
-
],
|
|
22
|
-
future: {
|
|
23
|
-
v2_errorBoundary: true,
|
|
24
|
-
v2_headers: true,
|
|
25
|
-
v2_meta: true,
|
|
26
|
-
v2_normalizeFormMethod: true,
|
|
27
|
-
v2_routeConvention: true,
|
|
28
|
-
v2_dev: true,
|
|
29
|
-
},
|
|
30
|
-
};
|