Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
softmarshmallow committed Dec 17, 2023
1 parent 7ea04aa commit 8dcded6
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 41 deletions.
32 changes: 22 additions & 10 deletions code/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { RemoteImageRepositories } from "@design-sdk/figma-remote/asset-reposito
import type { FrameworkConfig } from "@grida/builder-config";
import { defaultConfigByFramework } from "@grida/builder-config-preset";
import { Language } from "@grida/builder-platform-types";
import { formatCode } from "dart-style";
import type { TPlugin } from "@code-plugin/core";

export async function code({
Expand All @@ -20,10 +19,10 @@ export async function code({
plugins,
}: {
auth:
| {
personalAccessToken: string;
}
| { accessToken: string };
| {
personalAccessToken: string;
}
| { accessToken: string };
uri: string;
framework: FrameworkConfig;
plugins?: TPlugin[];
Expand Down Expand Up @@ -96,11 +95,24 @@ function filesrc(

function postproc_src(src: string, language: Language) {
if (language === Language.dart) {
const { code, error } = formatCode(src);
if (error) {
return src;
}
return code;
// TODO: disabling dart formatter due to run time error.
// ```
// dartException: TypeErrorImplementation {
// message: "TypeError: Instance of 'JavaScriptFunction': type 'JavaScriptFunction' is not a subtype of type 'Function1'"
// }
// ```

// import { formatCode } from "dart-style";

// try {
// const { code, error } = formatCode(src);
// if (error) {
// return src;
// }
// return code;
// } catch (e) {
// return src;
// }
}

return src;
Expand Down
2 changes: 1 addition & 1 deletion www/app/v1/code/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { type NextRequest, NextResponse } from "next/server";

type FigmaAccessTokenType = "fat" | "fpat";

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

Expand Down
13 changes: 12 additions & 1 deletion www/app/v1/embed/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Language } from "@grida/builder-platform-types";
import { code } from "@grida/code";
import { NextResponse, type NextRequest } from "next/server";

export default async function GET(req: NextRequest) {
export async function GET(req: NextRequest) {
// get the access token from the query string
const figma = req.nextUrl.searchParams.get("figma") as string;
const fpat = req.nextUrl.searchParams.get("fpat") as string;
Expand All @@ -11,6 +11,9 @@ export default async function GET(req: NextRequest) {
if (!figma) {
return new NextResponse("<h1>No figma file url is provided</h1>", {
status: 400,
headers: {
"Content-Type": "text/html",
}
});
}

Expand Down Expand Up @@ -51,4 +54,12 @@ export default async function GET(req: NextRequest) {
},
});
}


return new NextResponse("<h1>Something went wrong</h1>", {
status: 500,
headers: {
"Content-Type": "text/html",
},
});
}
57 changes: 55 additions & 2 deletions www/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
const packages = [
"@engine/core",

// -----------------------------
// region @designto-code
"@grida/api",
"@grida/code",
"@designto/debugger",
"@grida/builder-config",
"@grida/builder-config-preset",
"@grida/builder-platform-types",
"@designto/code",
"@designto/sanitized",
"@designto/token",
"@designto/flutter",
"@designto/solid-js",
"@designto/web",
"@designto/vanilla",
"@designto/react",
"@designto/react-native",

"@code-features/assets",
"@code-features/module",
"@code-features/documentation",
"@code-features/component",
"@code-features/flags",
"@code-features/fonts",
// -----------------------------
// plugins
"@code-plugin/core",
"@code-plugin/text-fit",
// -----------------------------

// -----------------------------
// region builders - part of designto-code / coli

// region web builders
"@web-builder/nodejs",
"@web-builder/core",
"@web-builder/module-es",
"@web-builder/module-jsx",
"@web-builder/solid-js",
"@web-builder/vanilla",
"@web-builder/react-core",
"@web-builder/react",
"@web-builder/react-native",
"@web-builder/reflect-ui",
"@web-builder/styled",
"@web-builder/styles",
// endregion web builders
// -----------------------------
];

/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {};

module.exports = nextConfig
module.exports = nextConfig;
11 changes: 6 additions & 5 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
"lint": "next lint"
},
"dependencies": {
"dart-style": "^1.3.2-dev",
"next": "14.0.4",
"react": "^18",
"react-dom": "^18",
"next": "14.0.4"
"react-dom": "^18"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"eslint": "^8",
"eslint-config-next": "14.0.4"
"typescript": "^5"
}
}
74 changes: 52 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1505,10 +1505,10 @@
resolved "https://registry.npmjs.org/@design-sdk/figma-auth-store/-/figma-auth-store-0.0.43.tgz"
integrity sha512-5VF1EijfZwzOMq+r4ipQ0aDRk/JSUHOjg9cI7oaD+K+sw2YIjgxSBE05/tvncZhOpmFvDHSHTISYJfUsEWfSUQ==

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

"@design-sdk/figma-node-conversion@^0.0.43":
version "0.0.43"
Expand All @@ -1531,13 +1531,13 @@
"@design-sdk/figma-node" "^0.0.43"
"@design-sdk/figma-types" "^0.0.43"

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

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

"@design-sdk/figma-utils@^0.0.25":
version "0.0.25"
resolved "https://registry.yarnpkg.com/@design-sdk/figma-utils/-/figma-utils-0.0.25.tgz#7b7f6632fd8689ef713b27b34a61257accc2052e"
integrity sha512-HarFMa14L9zqg8rhLaCTXhTKFd6tlBno1mnSc/vl8ZVilmdq32OFFlmqS4MjyvrTfyAvbwlEMAhxV1SUQhFhRg==

"@design-sdk/figma-utils@^0.0.43":
version "0.0.43"
resolved "https://registry.npmjs.org/@design-sdk/figma-utils/-/figma-utils-0.0.43.tgz"
Expand Down Expand Up @@ -6856,10 +6851,22 @@
resolved "https://registry.npmjs.org/@reflect-ui/cg/-/cg-0.0.5.tgz"
integrity sha512-rqqaumLDgk9dGtPgkYy9h5PLlNv8ZVEz/+ktOcJpJE6v9fAQOSH1Wh5WAehpiZTQtKe944GzrFMsb/g8pTabWg==

"@reflect-ui/core@0.0.12", "@reflect-ui/core@0.0.2-rc.7", "@reflect-ui/core@0.0.5", "@reflect-ui/core@^0.0.5", "@reflect-ui/core@^0.0.9":
version "0.0.12"
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.12.tgz#f410ecef10ce4ecb2cffdda93056091d68ce2b87"
integrity sha512-Ae/2ImJ70d1PrcVLmQgJhxTr5RZA6wxLeTgxRaATA3nryjp4aiz7pznzd3EqX0zii+7N79Xpk20KCuXJByypuA==
"@reflect-ui/core@0.0.2-rc.7":
version "0.0.2-rc.7"
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.2-rc.7.tgz#9d531f5a0b9caab31e7563020044b753700e2bbc"
integrity sha512-EqF4SRU57bfa5DOPET1rv5lROFyMVHLv1xTEIlN6N2gDpXt71QceImWfQp3z3Khqnb4R/p9OhNK6DXGUpozWKw==

"@reflect-ui/core@0.0.5", "@reflect-ui/core@^0.0.5":
version "0.0.5"
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.5.tgz#f50ae00e64300c4b698ab5c5374c6ac3bb5de873"
integrity sha512-lA6AYHCF8aSyOvGXbJZcmlB5ccxCaznhxvD8Hg1UjVdhcbLhMWDbzoYqbrkqh+R4im3KnYw5n6pWSSdoWioYhA==
dependencies:
"@reflect-ui/uiutils" "^0.1.2-1"

"@reflect-ui/core@^0.0.9":
version "0.0.9"
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.9.tgz#7283a2a3a1edde16282559d11f02e23d3bceda36"
integrity sha512-MNJq+Pc45qZ0IvTYuvzCW2nxupVRfMtmin9vepABo2h1sTKdAmCK2kPfVLea6TNiF1baJDeQg7IyAN45JMuFdA==
dependencies:
"@reflect-ui/uiutils" "^0.1.2-1"

Expand Down Expand Up @@ -9379,7 +9386,7 @@
dependencies:
"@types/react" "*"

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

"@types/react@^17":
version "17.0.73"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.73.tgz#23a663c803b18d8b7f4f2bb9b467f2f3fd70787a"
integrity sha512-6AcjgPIVsXTIsFDgsGW0iQhvg0xb2vt2qAWgXyncnVNRaW9ZXTTwAh7RQoh7PzK1AhjPoGDvUBkdAREih9n5oQ==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^18.0.25":
version "18.2.45"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.45.tgz#253f4fac288e7e751ab3dc542000fb687422c15c"
integrity sha512-TtAxCNrlrBp8GoeEp1npd5g+d/OejJHFxS3OWmrPBMFaVQMSN0OFySozJio5BHxTuTeug00AVXVAjfDSfk+lUg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/resemblejs@^4.1.3":
version "4.1.3"
resolved "https://registry.yarnpkg.com/@types/resemblejs/-/resemblejs-4.1.3.tgz#46d16888952e377b9143484c206b63f6da56e91e"
Expand Down Expand Up @@ -12867,11 +12892,16 @@ cssesc@^3.0.0:
resolved "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz"
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==

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

csstype@^3.1.1:
version "3.1.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==

cuid@^2.1.8:
version "2.1.8"
resolved "https://registry.npmjs.org/cuid/-/cuid-2.1.8.tgz"
Expand Down Expand Up @@ -12998,7 +13028,7 @@ dart-services@^0.2.3, dart-services@^0.2.5:

dart-style@^1.3.2-dev:
version "1.3.2-dev"
resolved "https://registry.npmjs.org/dart-style/-/dart-style-1.3.2-dev.tgz"
resolved "https://registry.yarnpkg.com/dart-style/-/dart-style-1.3.2-dev.tgz#d21a80ff0b7f9d800584ec6a6a659ac3242ac855"
integrity sha512-NFI4UQYvG32t/cEkQAdkXT2ZT72tjF61tMWoALmnGwj03d2Co94zwGfbnFfdQUQvrhUNx8Wz2jKSVxGrmFaVJQ==

dashdash@^1.12.0:
Expand Down

1 comment on commit 8dcded6

@vercel
Copy link

@vercel vercel bot commented on 8dcded6 Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.