Skip to content

Fix build issues #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions client/packages/lowcoder/src/base/codeEditor/autoFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import { format as formatSQL } from "sql-formatter";
import { Language } from "./codeEditorTypes";

export async function cssFormatter(text: string) {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserPlugin = await require("prettier/parser-postcss");
return (await prettier.format(text, { parser: "css", plugins: [parserPlugin], semi: false })).trim();
}

export async function htmlFormatter(text: string) {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserPlugin = await require("prettier/parser-html");
return (await prettier.format(text, { parser: "html", plugins: [parserPlugin], semi: false })).trim();
}

async function getJavascriptFormatter() {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserBabel = await require("prettier/parser-babel");
return async (text: string) =>
(await prettier.format(text, { parser: "babel", plugins: [parserBabel], semi: false })).trim();
}

export async function getJsonFormatter() {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserBabel = await require("prettier/parser-babel");
return async (text: string) => (await prettier.format(text, { parser: "json", plugins: [parserBabel] })).trim();
}
Expand Down Expand Up @@ -130,7 +130,7 @@ async function formatJsonWithJsSnippetsImpl(text: string) {
return segment;
}));

return (await formattedJSON).replace(/("{{\d+}}")|({{\d+}})|(\\\\{\\\\{\d+\\\\}\\\\})/g, (s) => {
return (await formattedJSON).replace(/("{{\d+}}")|({{\d+}})|(\\\\{\\\\{\d+\\\\}\\\\})/g, (s: string) => {
const index = parseInt(
s.startsWith('"{{') ? s.slice(3, -3) : s.startsWith("{{") ? s.slice(2, -2) : s.slice(6, -6)
);
Expand Down
15 changes: 0 additions & 15 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12328,21 +12328,6 @@ __metadata:
languageName: unknown
linkType: soft

"lowcoder-hillcharts@workspace:packages/lowcoder-hillcharts":
version: 0.0.0-use.local
resolution: "lowcoder-hillcharts@workspace:packages/lowcoder-hillcharts"
dependencies:
"@types/react": 17
"@types/react-dom": 17
lowcoder-dev-utils: ^0.0.6
lowcoder-sdk: ^2.1.9
react: 17
react-dom: 17
typescript: 5.3.3
vite: ^5.0.6
languageName: unknown
linkType: soft

"lowcoder-plugin-demo@workspace:packages/lowcoder-plugin-demo":
version: 0.0.0-use.local
resolution: "lowcoder-plugin-demo@workspace:packages/lowcoder-plugin-demo"
Expand Down