Skip to content

Commit 8dcded6

Browse files
fix errors
1 parent 7ea04aa commit 8dcded6

File tree

6 files changed

+148
-41
lines changed

6 files changed

+148
-41
lines changed

code/index.ts

+22-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { RemoteImageRepositories } from "@design-sdk/figma-remote/asset-reposito
1010
import type { FrameworkConfig } from "@grida/builder-config";
1111
import { defaultConfigByFramework } from "@grida/builder-config-preset";
1212
import { Language } from "@grida/builder-platform-types";
13-
import { formatCode } from "dart-style";
1413
import type { TPlugin } from "@code-plugin/core";
1514

1615
export async function code({
@@ -20,10 +19,10 @@ export async function code({
2019
plugins,
2120
}: {
2221
auth:
23-
| {
24-
personalAccessToken: string;
25-
}
26-
| { accessToken: string };
22+
| {
23+
personalAccessToken: string;
24+
}
25+
| { accessToken: string };
2726
uri: string;
2827
framework: FrameworkConfig;
2928
plugins?: TPlugin[];
@@ -96,11 +95,24 @@ function filesrc(
9695

9796
function postproc_src(src: string, language: Language) {
9897
if (language === Language.dart) {
99-
const { code, error } = formatCode(src);
100-
if (error) {
101-
return src;
102-
}
103-
return code;
98+
// TODO: disabling dart formatter due to run time error.
99+
// ```
100+
// dartException: TypeErrorImplementation {
101+
// message: "TypeError: Instance of 'JavaScriptFunction': type 'JavaScriptFunction' is not a subtype of type 'Function1'"
102+
// }
103+
// ```
104+
105+
// import { formatCode } from "dart-style";
106+
107+
// try {
108+
// const { code, error } = formatCode(src);
109+
// if (error) {
110+
// return src;
111+
// }
112+
// return code;
113+
// } catch (e) {
114+
// return src;
115+
// }
104116
}
105117

106118
return src;

www/app/v1/code/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { type NextRequest, NextResponse } from "next/server";
77

88
type FigmaAccessTokenType = "fat" | "fpat";
99

10-
export default async function POST(req: NextRequest) {
10+
export async function POST(req: NextRequest) {
1111
try {
1212
const figma_access_token: string | null = req.headers.get("x-figma-token");
1313

www/app/v1/embed/route.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Language } from "@grida/builder-platform-types";
22
import { code } from "@grida/code";
33
import { NextResponse, type NextRequest } from "next/server";
44

5-
export default async function GET(req: NextRequest) {
5+
export async function GET(req: NextRequest) {
66
// get the access token from the query string
77
const figma = req.nextUrl.searchParams.get("figma") as string;
88
const fpat = req.nextUrl.searchParams.get("fpat") as string;
@@ -11,6 +11,9 @@ export default async function GET(req: NextRequest) {
1111
if (!figma) {
1212
return new NextResponse("<h1>No figma file url is provided</h1>", {
1313
status: 400,
14+
headers: {
15+
"Content-Type": "text/html",
16+
}
1417
});
1518
}
1619

@@ -51,4 +54,12 @@ export default async function GET(req: NextRequest) {
5154
},
5255
});
5356
}
57+
58+
59+
return new NextResponse("<h1>Something went wrong</h1>", {
60+
status: 500,
61+
headers: {
62+
"Content-Type": "text/html",
63+
},
64+
});
5465
}

www/next.config.js

+55-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,57 @@
1+
const packages = [
2+
"@engine/core",
3+
4+
// -----------------------------
5+
// region @designto-code
6+
"@grida/api",
7+
"@grida/code",
8+
"@designto/debugger",
9+
"@grida/builder-config",
10+
"@grida/builder-config-preset",
11+
"@grida/builder-platform-types",
12+
"@designto/code",
13+
"@designto/sanitized",
14+
"@designto/token",
15+
"@designto/flutter",
16+
"@designto/solid-js",
17+
"@designto/web",
18+
"@designto/vanilla",
19+
"@designto/react",
20+
"@designto/react-native",
21+
22+
"@code-features/assets",
23+
"@code-features/module",
24+
"@code-features/documentation",
25+
"@code-features/component",
26+
"@code-features/flags",
27+
"@code-features/fonts",
28+
// -----------------------------
29+
// plugins
30+
"@code-plugin/core",
31+
"@code-plugin/text-fit",
32+
// -----------------------------
33+
34+
// -----------------------------
35+
// region builders - part of designto-code / coli
36+
37+
// region web builders
38+
"@web-builder/nodejs",
39+
"@web-builder/core",
40+
"@web-builder/module-es",
41+
"@web-builder/module-jsx",
42+
"@web-builder/solid-js",
43+
"@web-builder/vanilla",
44+
"@web-builder/react-core",
45+
"@web-builder/react",
46+
"@web-builder/react-native",
47+
"@web-builder/reflect-ui",
48+
"@web-builder/styled",
49+
"@web-builder/styles",
50+
// endregion web builders
51+
// -----------------------------
52+
];
53+
154
/** @type {import('next').NextConfig} */
2-
const nextConfig = {}
55+
const nextConfig = {};
356

4-
module.exports = nextConfig
57+
module.exports = nextConfig;

www/package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"dart-style": "^1.3.2-dev",
13+
"next": "14.0.4",
1214
"react": "^18",
13-
"react-dom": "^18",
14-
"next": "14.0.4"
15+
"react-dom": "^18"
1516
},
1617
"devDependencies": {
17-
"typescript": "^5",
1818
"@types/node": "^20",
1919
"@types/react": "^18",
2020
"@types/react-dom": "^18",
2121
"autoprefixer": "^10.0.1",
22+
"eslint": "^8",
23+
"eslint-config-next": "14.0.4",
2224
"postcss": "^8",
2325
"tailwindcss": "^3.3.0",
24-
"eslint": "^8",
25-
"eslint-config-next": "14.0.4"
26+
"typescript": "^5"
2627
}
2728
}

yarn.lock

+52-22
Original file line numberDiff line numberDiff line change
@@ -1505,10 +1505,10 @@
15051505
resolved "https://registry.npmjs.org/@design-sdk/figma-auth-store/-/figma-auth-store-0.0.43.tgz"
15061506
integrity sha512-5VF1EijfZwzOMq+r4ipQ0aDRk/JSUHOjg9cI7oaD+K+sw2YIjgxSBE05/tvncZhOpmFvDHSHTISYJfUsEWfSUQ==
15071507

1508-
"@design-sdk/figma-core@^0.0.25":
1509-
version "0.0.25"
1510-
resolved "https://registry.yarnpkg.com/@design-sdk/figma-core/-/figma-core-0.0.25.tgz#7fa28cc7d6e45cd713c5f268d42e4dd4f2b41590"
1511-
integrity sha512-6OF7eUbDOlR4/BFtd2FRyDvvUf777OGNbVbNScUOv3Fk/kUXBzMTXX6ZdoRlTx887v/vo3+Lh0D31SG1sm80aA==
1508+
"@design-sdk/figma-core@^0.0.43":
1509+
version "0.0.43"
1510+
resolved "https://registry.yarnpkg.com/@design-sdk/figma-core/-/figma-core-0.0.43.tgz#0d19d014daf398ed39046bfd4e7f3d2b78842943"
1511+
integrity sha512-7WQ29f4hUOxu4Mu8ZyqbBI5F4DsRJbIjGIcZAUmn7O9/SRR00upTYrl2hdlEnKdE0ImHTYqfISgxjkoYEQgZaQ==
15121512

15131513
"@design-sdk/figma-node-conversion@^0.0.43":
15141514
version "0.0.43"
@@ -1531,13 +1531,13 @@
15311531
"@design-sdk/figma-node" "^0.0.43"
15321532
"@design-sdk/figma-types" "^0.0.43"
15331533

1534-
"@design-sdk/figma-node@0.0.25", "@design-sdk/figma-node@^0.0.43":
1535-
version "0.0.25"
1536-
resolved "https://registry.yarnpkg.com/@design-sdk/figma-node/-/figma-node-0.0.25.tgz#c95484cc4b003667ae93e95fa3b585b9fa0b740a"
1537-
integrity sha512-GCA5cGDXhvGUQddmSIZgPMhH0eGip9S0yDSQiys1XiKnXsB/CM8/5C+JVosHR1WFMHSlJfU+ytA4IH2yhfysUQ==
1534+
"@design-sdk/figma-node@^0.0.43":
1535+
version "0.0.43"
1536+
resolved "https://registry.yarnpkg.com/@design-sdk/figma-node/-/figma-node-0.0.43.tgz#5d468ae73e2b07a787d4e6447cdde7efb4f2ea43"
1537+
integrity sha512-Wo3jNL4S8NjqbwZZG4eXe2ut/HVM/vPGaEFoEa8MIJyTslwS+sobiU4TW2qDUYNVZW/L7fxYdHO+sBDQOx0TWw==
15381538
dependencies:
1539-
"@design-sdk/figma-core" "^0.0.25"
1540-
"@design-sdk/figma-utils" "^0.0.25"
1539+
"@design-sdk/figma-core" "^0.0.43"
1540+
"@design-sdk/figma-utils" "^0.0.43"
15411541
"@reflect-ui/font-utils" "^0.0.1"
15421542

15431543
"@design-sdk/figma-remote-api@^0.0.43":
@@ -1581,11 +1581,6 @@
15811581
resolved "https://registry.yarnpkg.com/@design-sdk/figma-url/-/figma-url-0.0.46.tgz#8cf8eecbb80685480822734bfa871af6e5fa0daa"
15821582
integrity sha512-9d8Og45cPxRe3Oh8wzWHhFrxZYfaoBdfP/J0OfYs2yTK7XY/vhz1GGf78aBjGdBdmaShHwfI8RHIhhV03nYKkg==
15831583

1584-
"@design-sdk/figma-utils@^0.0.25":
1585-
version "0.0.25"
1586-
resolved "https://registry.yarnpkg.com/@design-sdk/figma-utils/-/figma-utils-0.0.25.tgz#7b7f6632fd8689ef713b27b34a61257accc2052e"
1587-
integrity sha512-HarFMa14L9zqg8rhLaCTXhTKFd6tlBno1mnSc/vl8ZVilmdq32OFFlmqS4MjyvrTfyAvbwlEMAhxV1SUQhFhRg==
1588-
15891584
"@design-sdk/figma-utils@^0.0.43":
15901585
version "0.0.43"
15911586
resolved "https://registry.npmjs.org/@design-sdk/figma-utils/-/figma-utils-0.0.43.tgz"
@@ -6856,10 +6851,22 @@
68566851
resolved "https://registry.npmjs.org/@reflect-ui/cg/-/cg-0.0.5.tgz"
68576852
integrity sha512-rqqaumLDgk9dGtPgkYy9h5PLlNv8ZVEz/+ktOcJpJE6v9fAQOSH1Wh5WAehpiZTQtKe944GzrFMsb/g8pTabWg==
68586853

6859-
"@reflect-ui/[email protected]", "@reflect-ui/[email protected]", "@reflect-ui/[email protected]", "@reflect-ui/core@^0.0.5", "@reflect-ui/core@^0.0.9":
6860-
version "0.0.12"
6861-
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.12.tgz#f410ecef10ce4ecb2cffdda93056091d68ce2b87"
6862-
integrity sha512-Ae/2ImJ70d1PrcVLmQgJhxTr5RZA6wxLeTgxRaATA3nryjp4aiz7pznzd3EqX0zii+7N79Xpk20KCuXJByypuA==
6854+
"@reflect-ui/[email protected]":
6855+
version "0.0.2-rc.7"
6856+
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.2-rc.7.tgz#9d531f5a0b9caab31e7563020044b753700e2bbc"
6857+
integrity sha512-EqF4SRU57bfa5DOPET1rv5lROFyMVHLv1xTEIlN6N2gDpXt71QceImWfQp3z3Khqnb4R/p9OhNK6DXGUpozWKw==
6858+
6859+
"@reflect-ui/[email protected]", "@reflect-ui/core@^0.0.5":
6860+
version "0.0.5"
6861+
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.5.tgz#f50ae00e64300c4b698ab5c5374c6ac3bb5de873"
6862+
integrity sha512-lA6AYHCF8aSyOvGXbJZcmlB5ccxCaznhxvD8Hg1UjVdhcbLhMWDbzoYqbrkqh+R4im3KnYw5n6pWSSdoWioYhA==
6863+
dependencies:
6864+
"@reflect-ui/uiutils" "^0.1.2-1"
6865+
6866+
"@reflect-ui/core@^0.0.9":
6867+
version "0.0.9"
6868+
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.9.tgz#7283a2a3a1edde16282559d11f02e23d3bceda36"
6869+
integrity sha512-MNJq+Pc45qZ0IvTYuvzCW2nxupVRfMtmin9vepABo2h1sTKdAmCK2kPfVLea6TNiF1baJDeQg7IyAN45JMuFdA==
68636870
dependencies:
68646871
"@reflect-ui/uiutils" "^0.1.2-1"
68656872

@@ -9379,7 +9386,7 @@
93799386
dependencies:
93809387
"@types/react" "*"
93819388

9382-
"@types/react@*", "@types/react@18.0.24", "@types/react@^17", "@types/react@^18", "@types/react@^18.0.24", "@types/react@^18.0.25":
9389+
"@types/react@*", "@types/react@^18", "@types/react@^18.0.24":
93839390
version "18.0.24"
93849391
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.24.tgz#2f79ed5b27f08d05107aab45c17919754cc44c20"
93859392
integrity sha512-wRJWT6ouziGUy+9uX0aW4YOJxAY0bG6/AOk5AW5QSvZqI7dk6VBIbXvcVgIw/W5Jrl24f77df98GEKTJGOLx7Q==
@@ -9388,6 +9395,24 @@
93889395
"@types/scheduler" "*"
93899396
csstype "^3.0.2"
93909397

9398+
"@types/react@^17":
9399+
version "17.0.73"
9400+
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.73.tgz#23a663c803b18d8b7f4f2bb9b467f2f3fd70787a"
9401+
integrity sha512-6AcjgPIVsXTIsFDgsGW0iQhvg0xb2vt2qAWgXyncnVNRaW9ZXTTwAh7RQoh7PzK1AhjPoGDvUBkdAREih9n5oQ==
9402+
dependencies:
9403+
"@types/prop-types" "*"
9404+
"@types/scheduler" "*"
9405+
csstype "^3.0.2"
9406+
9407+
"@types/react@^18.0.25":
9408+
version "18.2.45"
9409+
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.45.tgz#253f4fac288e7e751ab3dc542000fb687422c15c"
9410+
integrity sha512-TtAxCNrlrBp8GoeEp1npd5g+d/OejJHFxS3OWmrPBMFaVQMSN0OFySozJio5BHxTuTeug00AVXVAjfDSfk+lUg==
9411+
dependencies:
9412+
"@types/prop-types" "*"
9413+
"@types/scheduler" "*"
9414+
csstype "^3.0.2"
9415+
93919416
"@types/resemblejs@^4.1.3":
93929417
version "4.1.3"
93939418
resolved "https://registry.yarnpkg.com/@types/resemblejs/-/resemblejs-4.1.3.tgz#46d16888952e377b9143484c206b63f6da56e91e"
@@ -12867,11 +12892,16 @@ cssesc@^3.0.0:
1286712892
resolved "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz"
1286812893
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
1286912894

12870-
csstype@3.1.0, csstype@^3.0.10, csstype@^3.0.2, csstype@^3.0.4, csstype@^3.0.8, csstype@^3.1.1:
12895+
csstype@^3.0.10, csstype@^3.0.2, csstype@^3.0.4, csstype@^3.0.8:
1287112896
version "3.1.0"
1287212897
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.0.tgz#4ddcac3718d787cf9df0d1b7d15033925c8f29f2"
1287312898
integrity sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==
1287412899

12900+
csstype@^3.1.1:
12901+
version "3.1.3"
12902+
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
12903+
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==
12904+
1287512905
cuid@^2.1.8:
1287612906
version "2.1.8"
1287712907
resolved "https://registry.npmjs.org/cuid/-/cuid-2.1.8.tgz"
@@ -12998,7 +13028,7 @@ dart-services@^0.2.3, dart-services@^0.2.5:
1299813028

1299913029
dart-style@^1.3.2-dev:
1300013030
version "1.3.2-dev"
13001-
resolved "https://registry.npmjs.org/dart-style/-/dart-style-1.3.2-dev.tgz"
13031+
resolved "https://registry.yarnpkg.com/dart-style/-/dart-style-1.3.2-dev.tgz#d21a80ff0b7f9d800584ec6a6a659ac3242ac855"
1300213032
integrity sha512-NFI4UQYvG32t/cEkQAdkXT2ZT72tjF61tMWoALmnGwj03d2Co94zwGfbnFfdQUQvrhUNx8Wz2jKSVxGrmFaVJQ==
1300313033

1300413034
dashdash@^1.12.0:

0 commit comments

Comments
 (0)