webstudio 0.143.1 → 0.144.1-710b1d2.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 +32 -23
- package/package.json +24 -11
- package/templates/cloudflare/WS_CF_README.md +48 -0
- package/templates/cloudflare/functions/[[path]].ts +8 -0
- package/templates/cloudflare/load-context.ts +9 -0
- package/templates/cloudflare/package.json +28 -0
- package/templates/cloudflare/tsconfig.json +36 -0
- package/templates/cloudflare/vite.config.ts +15 -0
- package/templates/cloudflare/worker-configuration.d.ts +3 -0
- package/templates/cloudflare/wrangler.toml +55 -0
- package/templates/defaults/__templates__/route-template.tsx +11 -11
- 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/package.json +16 -15
- package/templates/defaults/tsconfig.json +3 -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/saas-helpers/package.json +6 -0
- package/templates/vercel/package.json +1 -5
- package/templates/defaults/remix.config.js +0 -19
- package/templates/defaults/remix.env.d.ts +0 -2
- 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
|
);
|
|
@@ -368,7 +368,7 @@ var prebuild = async (options) => {
|
|
|
368
368
|
if (template === "vanilla") {
|
|
369
369
|
continue;
|
|
370
370
|
}
|
|
371
|
-
if (template.startsWith(".")) {
|
|
371
|
+
if (template.startsWith(".") || template.startsWith("/")) {
|
|
372
372
|
continue;
|
|
373
373
|
}
|
|
374
374
|
if (await isCliTemplate(template) === false) {
|
|
@@ -545,20 +545,16 @@ var prebuild = async (options) => {
|
|
|
545
545
|
}
|
|
546
546
|
const assets = new Map(siteData.assets.map((asset) => [asset.id, asset]));
|
|
547
547
|
spinner.text = "Generating css file";
|
|
548
|
-
const { cssText, classesMap } = generateCss(
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
assetBaseUrl,
|
|
559
|
-
atomic: siteData.build.pages.compiler?.atomicStyles ?? true
|
|
560
|
-
}
|
|
561
|
-
);
|
|
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
|
+
});
|
|
562
558
|
await ensureFileInPath(join4(generatedDir, "index.css"), cssText);
|
|
563
559
|
spinner.text = "Generating routes and pages";
|
|
564
560
|
const routeTemplatePath = normalize(
|
|
@@ -738,9 +734,9 @@ export const projectMeta: ProjectMeta =
|
|
|
738
734
|
for (const redirect of redirects) {
|
|
739
735
|
const redirectPagePath = generateRemixRoute(redirect.old);
|
|
740
736
|
const redirectFileName = `${redirectPagePath}.ts`;
|
|
741
|
-
const content = `import { type
|
|
737
|
+
const content = `import { type LoaderFunctionArgs, redirect } from "@remix-run/server-runtime";
|
|
742
738
|
|
|
743
|
-
export const loader = (arg:
|
|
739
|
+
export const loader = (arg: LoaderFunctionArgs) => {
|
|
744
740
|
return redirect("${redirect.new}", ${redirect.status ?? 301});
|
|
745
741
|
};
|
|
746
742
|
`;
|
|
@@ -921,7 +917,7 @@ import makeCLI from "yargs";
|
|
|
921
917
|
// package.json
|
|
922
918
|
var package_default = {
|
|
923
919
|
name: "webstudio",
|
|
924
|
-
version: "0.
|
|
920
|
+
version: "0.144.1-710b1d2.0",
|
|
925
921
|
description: "Webstudio CLI",
|
|
926
922
|
author: "Webstudio <github@webstudio.is>",
|
|
927
923
|
homepage: "https://webstudio.is",
|
|
@@ -965,12 +961,25 @@ var package_default = {
|
|
|
965
961
|
zod: "^3.22.4"
|
|
966
962
|
},
|
|
967
963
|
devDependencies: {
|
|
964
|
+
"@netlify/remix-adapter": "^2.3.0",
|
|
965
|
+
"@netlify/remix-edge-adapter": "3.2.0",
|
|
966
|
+
"@remix-run/cloudflare": "^2.8.1",
|
|
967
|
+
"@remix-run/cloudflare-pages": "^2.8.1",
|
|
968
|
+
"@remix-run/dev": "^2.8.1",
|
|
969
|
+
"@remix-run/node": "^2.8.1",
|
|
970
|
+
"@remix-run/react": "^2.8.1",
|
|
971
|
+
"@remix-run/server-runtime": "^2.8.1",
|
|
968
972
|
"@types/node": "^18.17.1",
|
|
969
973
|
"@types/prompts": "^2.4.5",
|
|
974
|
+
"@types/react": "^18.2.20",
|
|
975
|
+
"@types/react-dom": "^18.2.7",
|
|
976
|
+
"@types/yargs": "^17.0.32",
|
|
970
977
|
"@webstudio-is/form-handlers": "workspace:*",
|
|
971
978
|
"@webstudio-is/tsconfig": "workspace:*",
|
|
972
|
-
tsx: "^
|
|
973
|
-
typescript: "5.2.2"
|
|
979
|
+
tsx: "^4.7.2",
|
|
980
|
+
typescript: "5.2.2",
|
|
981
|
+
"vite-tsconfig-paths": "^4.3.2",
|
|
982
|
+
wrangler: "^3.48.0"
|
|
974
983
|
}
|
|
975
984
|
};
|
|
976
985
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webstudio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.144.1-710b1d2.0",
|
|
4
4
|
"description": "Webstudio CLI",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -28,21 +28,34 @@
|
|
|
28
28
|
"title-case": "^4.1.0",
|
|
29
29
|
"yargs": "^17.7.2",
|
|
30
30
|
"zod": "^3.22.4",
|
|
31
|
-
"@webstudio-is/image": "0.
|
|
32
|
-
"@webstudio-is/http-client": "0.
|
|
33
|
-
"@webstudio-is/react-sdk": "0.
|
|
34
|
-
"@webstudio-is/sdk": "0.
|
|
35
|
-
"@webstudio-is/sdk-components-react
|
|
36
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
37
|
-
"@webstudio-is/sdk-components-react-remix": "0.
|
|
31
|
+
"@webstudio-is/image": "0.144.1-710b1d2.0",
|
|
32
|
+
"@webstudio-is/http-client": "0.144.1-710b1d2.0",
|
|
33
|
+
"@webstudio-is/react-sdk": "0.144.1-710b1d2.0",
|
|
34
|
+
"@webstudio-is/sdk": "0.144.1-710b1d2.0",
|
|
35
|
+
"@webstudio-is/sdk-components-react": "0.144.1-710b1d2.0",
|
|
36
|
+
"@webstudio-is/sdk-components-react-radix": "0.144.1-710b1d2.0",
|
|
37
|
+
"@webstudio-is/sdk-components-react-remix": "0.144.1-710b1d2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@netlify/remix-adapter": "^2.3.0",
|
|
41
|
+
"@netlify/remix-edge-adapter": "3.2.0",
|
|
42
|
+
"@remix-run/cloudflare": "^2.8.1",
|
|
43
|
+
"@remix-run/cloudflare-pages": "^2.8.1",
|
|
44
|
+
"@remix-run/dev": "^2.8.1",
|
|
45
|
+
"@remix-run/node": "^2.8.1",
|
|
46
|
+
"@remix-run/react": "^2.8.1",
|
|
47
|
+
"@remix-run/server-runtime": "^2.8.1",
|
|
40
48
|
"@types/node": "^18.17.1",
|
|
41
49
|
"@types/prompts": "^2.4.5",
|
|
42
|
-
"
|
|
50
|
+
"@types/react": "^18.2.20",
|
|
51
|
+
"@types/react-dom": "^18.2.7",
|
|
52
|
+
"@types/yargs": "^17.0.32",
|
|
53
|
+
"tsx": "^4.7.2",
|
|
43
54
|
"typescript": "5.2.2",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
55
|
+
"vite-tsconfig-paths": "^4.3.2",
|
|
56
|
+
"wrangler": "^3.48.0",
|
|
57
|
+
"@webstudio-is/form-handlers": "0.144.1-710b1d2.0",
|
|
58
|
+
"@webstudio-is/tsconfig": "1.0.8-710b1d2.0"
|
|
46
59
|
},
|
|
47
60
|
"scripts": {
|
|
48
61
|
"typecheck": "tsc",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Welcome to Remix + Vite!
|
|
2
|
+
|
|
3
|
+
📖 See the [Remix docs](https://remix.run/docs) and the [Remix Vite docs](https://remix.run/docs/en/main/future/vite) for details on supported features.
|
|
4
|
+
|
|
5
|
+
## Typegen
|
|
6
|
+
|
|
7
|
+
Generate types for your Cloudflare bindings in `wrangler.toml`:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm run typegen
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
You will need to rerun typegen whenever you make changes to `wrangler.toml`.
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
Run the Vite dev server:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm run dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To run Wrangler:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm run build
|
|
27
|
+
npm run start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Deployment
|
|
31
|
+
|
|
32
|
+
> [!WARNING]
|
|
33
|
+
> Cloudflare does _not_ use `wrangler.toml` to configure deployment bindings.
|
|
34
|
+
> You **MUST** [configure deployment bindings manually in the Cloudflare dashboard][bindings].
|
|
35
|
+
|
|
36
|
+
First, build your app for production:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm run build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then, deploy your app to Cloudflare Pages:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm run deploy
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
[bindings]: https://developers.cloudflare.com/pages/functions/bindings/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-ignore - the server build file is generated by `remix vite:build`
|
|
5
|
+
// eslint-disable-next-line import/no-unresolved
|
|
6
|
+
import * as build from "../build/server";
|
|
7
|
+
|
|
8
|
+
export const onRequest = createPagesFunctionHandler({ build });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "remix vite:build",
|
|
7
|
+
"deploy": "npm run build && wrangler pages deploy ./build/client",
|
|
8
|
+
"dev": "remix vite:dev",
|
|
9
|
+
"start": "wrangler pages dev ./build/client",
|
|
10
|
+
"typegen": "wrangler types",
|
|
11
|
+
"preview": "npm run build && wrangler pages dev ./build/client",
|
|
12
|
+
"build-cf-types": "wrangler types"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@remix-run/cloudflare": "^2.8.1",
|
|
16
|
+
"@remix-run/cloudflare-pages": "^2.8.1",
|
|
17
|
+
"isbot": "^4.1.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@cloudflare/workers-types": "^4.20240405.0",
|
|
21
|
+
"vite-tsconfig-paths": "^4.2.1",
|
|
22
|
+
"wrangler": "^3.48.0",
|
|
23
|
+
"miniflare": "^3.20231030.4"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18.0.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
"**/*.ts",
|
|
4
|
+
"**/*.tsx",
|
|
5
|
+
"**/.server/**/*.ts",
|
|
6
|
+
"**/.server/**/*.tsx",
|
|
7
|
+
"**/.client/**/*.ts",
|
|
8
|
+
"**/.client/**/*.tsx"
|
|
9
|
+
],
|
|
10
|
+
"compilerOptions": {
|
|
11
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
12
|
+
"types": [
|
|
13
|
+
"@remix-run/cloudflare",
|
|
14
|
+
"vite/client",
|
|
15
|
+
"@cloudflare/workers-types/2023-07-01"
|
|
16
|
+
],
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"jsx": "react-jsx",
|
|
20
|
+
"module": "ESNext",
|
|
21
|
+
"moduleResolution": "Bundler",
|
|
22
|
+
"resolveJsonModule": true,
|
|
23
|
+
"target": "ES2022",
|
|
24
|
+
"strict": true,
|
|
25
|
+
"allowJs": true,
|
|
26
|
+
"skipLibCheck": true,
|
|
27
|
+
"forceConsistentCasingInFileNames": true,
|
|
28
|
+
"baseUrl": ".",
|
|
29
|
+
"paths": {
|
|
30
|
+
"~/*": ["./app/*"]
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// Vite takes care of building everything, not tsc.
|
|
34
|
+
"noEmit": true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
vitePlugin as remix,
|
|
3
|
+
cloudflareDevProxyVitePlugin as remixCloudflareDevProxy,
|
|
4
|
+
} from "@remix-run/dev";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
7
|
+
|
|
8
|
+
export default defineConfig(({ mode }) => ({
|
|
9
|
+
plugins: [
|
|
10
|
+
// without this, remixCloudflareDevProxy trying to load workerd even for production (it's not needed for production)
|
|
11
|
+
mode === "production" ? undefined : remixCloudflareDevProxy(),
|
|
12
|
+
remix(),
|
|
13
|
+
tsconfigPaths(),
|
|
14
|
+
].filter(Boolean),
|
|
15
|
+
}));
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
2
|
+
# https://developers.cloudflare.com/pages/functions/wrangler-configuration/
|
|
3
|
+
name = "webstudio-remix-app"
|
|
4
|
+
compatibility_date = "2024-04-05"
|
|
5
|
+
pages_build_output_dir="./build"
|
|
6
|
+
|
|
7
|
+
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
8
|
+
# Note: Use secrets to store sensitive data.
|
|
9
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
10
|
+
# [vars]
|
|
11
|
+
# MY_VARIABLE = "production_value"
|
|
12
|
+
|
|
13
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
14
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
|
|
15
|
+
# [ai]
|
|
16
|
+
# binding = "AI"
|
|
17
|
+
|
|
18
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
19
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
|
|
20
|
+
# [[d1_databases]]
|
|
21
|
+
# binding = "MY_DB"
|
|
22
|
+
# database_name = "my-database"
|
|
23
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
24
|
+
|
|
25
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
26
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
27
|
+
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
|
|
28
|
+
# [[durable_objects.bindings]]
|
|
29
|
+
# name = "MY_DURABLE_OBJECT"
|
|
30
|
+
# class_name = "MyDurableObject"
|
|
31
|
+
# script_name = 'my-durable-object'
|
|
32
|
+
|
|
33
|
+
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
34
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
|
|
35
|
+
# [[kv_namespaces]]
|
|
36
|
+
# binding = "MY_KV_NAMESPACE"
|
|
37
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
38
|
+
|
|
39
|
+
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
40
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
|
|
41
|
+
# [[queues.producers]]
|
|
42
|
+
# binding = "MY_QUEUE"
|
|
43
|
+
# queue = "my-queue"
|
|
44
|
+
|
|
45
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
46
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
|
|
47
|
+
# [[r2_buckets]]
|
|
48
|
+
# binding = "MY_BUCKET"
|
|
49
|
+
# bucket_name = "my-bucket"
|
|
50
|
+
|
|
51
|
+
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
52
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
53
|
+
# [[services]]
|
|
54
|
+
# binding = "MY_SERVICE"
|
|
55
|
+
# service = "my-service"
|
|
@@ -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";
|
|
@@ -29,10 +29,10 @@ import {
|
|
|
29
29
|
projectMeta,
|
|
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
|
}
|
|
@@ -240,7 +240,7 @@ const getMethod = (value: string | undefined) => {
|
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
export const action = async ({ request, context }:
|
|
243
|
+
export const action = async ({ request, context }: ActionFunctionArgs) => {
|
|
244
244
|
const formData = await request.formData();
|
|
245
245
|
|
|
246
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,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,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"include": ["
|
|
2
|
+
"include": ["**/*.ts", "**/*.tsx", "**/*.mjs"],
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
5
|
+
"types": ["@remix-run/node", "vite/client"],
|
|
5
6
|
"isolatedModules": true,
|
|
6
7
|
"esModuleInterop": true,
|
|
7
8
|
"jsx": "react-jsx",
|
|
9
|
+
"module": "ESNext",
|
|
8
10
|
"moduleResolution": "bundler",
|
|
9
11
|
"resolveJsonModule": true,
|
|
10
12
|
"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
|
-
};
|