mirror of
https://github.com/ritz078/transform.git
synced 2026-12-04 05:44:30 +03:00
format code
This commit is contained in:
1 parent
d19a261563
commit
6150ff308f
79 files changed
+311
-307
No files matched your search
+2
-2
@@ -4,7 +4,7 @@ export const prettierParsers = {
|
||||
jsx: "babel",
|
||||
svg: "html",
|
||||
xml: "html",
|
||||
typescript: "typescript",
|
||||
typescript: "typescript"
|
||||
};
|
||||
|
||||
export const supportedLanguages = [
|
||||
@@ -17,5 +17,5 @@ export const supportedLanguages = [
|
||||
"yaml",
|
||||
"typescript",
|
||||
"flow",
|
||||
...Object.keys(prettierParsers),
|
||||
...Object.keys(prettierParsers)
|
||||
];
|
||||
+2
-2
@@ -9,7 +9,7 @@ const plugins = [
|
||||
require("prettier/parser-markdown"),
|
||||
require("prettier/parser-yaml"),
|
||||
require("prettier/parser-flow"),
|
||||
require("prettier/parser-typescript"),
|
||||
require("prettier/parser-typescript")
|
||||
];
|
||||
|
||||
export async function prettify(language: string, value: string) {
|
||||
@@ -22,7 +22,7 @@ export async function prettify(language: string, value: string) {
|
||||
} else {
|
||||
result = prettier.format(value, {
|
||||
parser: prettierParsers[language] || language,
|
||||
plugins,
|
||||
plugins
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
export default async function request(url: string, data: any) {
|
||||
const res = await fetch(url, {
|
||||
method: "POST",
|
||||
body: typeof data === "object" ? JSON.stringify(data) : data,
|
||||
body: typeof data === "object" ? JSON.stringify(data) : data
|
||||
});
|
||||
|
||||
return await res.text();
|
||||
|
||||
+65
-65
@@ -3,7 +3,7 @@ import { editor } from "monaco-editor";
|
||||
|
||||
export const ThemeContext = React.createContext({
|
||||
theme: "light",
|
||||
toggleTheme: () => {},
|
||||
toggleTheme: () => {}
|
||||
});
|
||||
|
||||
export const lightEditor: editor.IStandaloneThemeData = {
|
||||
@@ -13,154 +13,154 @@ export const lightEditor: editor.IStandaloneThemeData = {
|
||||
{
|
||||
foreground: "940494",
|
||||
background: "444494",
|
||||
token: "punctuation.definition.list",
|
||||
token: "punctuation.definition.list"
|
||||
},
|
||||
{
|
||||
foreground: "404f50",
|
||||
background: "5f0fff",
|
||||
fontStyle: "italic",
|
||||
token: "comment",
|
||||
token: "comment"
|
||||
},
|
||||
{
|
||||
foreground: "5a5f9b",
|
||||
background: "aaafdb",
|
||||
token: "string",
|
||||
token: "string"
|
||||
},
|
||||
{
|
||||
foreground: "4f827b",
|
||||
background: "77c2bb",
|
||||
token: "constant.numeric",
|
||||
token: "constant.numeric"
|
||||
},
|
||||
{
|
||||
foreground: "025f69",
|
||||
background: "7f2299",
|
||||
token: "constant.character",
|
||||
token: "constant.character"
|
||||
},
|
||||
{
|
||||
foreground: "025f69",
|
||||
background: "7f2299",
|
||||
token: "constant.other",
|
||||
token: "constant.other"
|
||||
},
|
||||
{
|
||||
foreground: "7d7e52",
|
||||
background: "bdbe82",
|
||||
token: "constant.language",
|
||||
token: "constant.language"
|
||||
},
|
||||
{
|
||||
foreground: "7b5d8f",
|
||||
background: "9b9ffd",
|
||||
fontStyle: "bold",
|
||||
token: "storage.modifier",
|
||||
token: "storage.modifier"
|
||||
},
|
||||
{
|
||||
foreground: "7b5cbf",
|
||||
background: "8b5ddf",
|
||||
fontStyle: "bold",
|
||||
token: "storage",
|
||||
token: "storage"
|
||||
},
|
||||
{
|
||||
foreground: "025f49",
|
||||
background: "22ff49",
|
||||
token: "entity.name.function",
|
||||
token: "entity.name.function"
|
||||
},
|
||||
{
|
||||
foreground: "9d7e62",
|
||||
background: "bdbe82",
|
||||
token: "support.function",
|
||||
token: "support.function"
|
||||
},
|
||||
{
|
||||
foreground: "939469",
|
||||
background: "e3e4a9",
|
||||
token: "entity.name.function.misc",
|
||||
token: "entity.name.function.misc"
|
||||
},
|
||||
{
|
||||
foreground: "856f63",
|
||||
background: "a5df93",
|
||||
token: "entity.name.function.predicate",
|
||||
token: "entity.name.function.predicate"
|
||||
},
|
||||
{
|
||||
foreground: "af938c",
|
||||
background: "dfb3ac",
|
||||
token: "entity.name.function.io",
|
||||
token: "entity.name.function.io"
|
||||
},
|
||||
{
|
||||
foreground: "7bafad",
|
||||
background: "bbdfdd",
|
||||
token: "variable.other.external-symbol",
|
||||
token: "variable.other.external-symbol"
|
||||
},
|
||||
{
|
||||
foreground: "316fcf",
|
||||
background: "3aafff",
|
||||
token: "variable.language",
|
||||
token: "variable.language"
|
||||
},
|
||||
{
|
||||
foreground: "316fcf",
|
||||
background: "3aafff",
|
||||
token: "variable.other",
|
||||
token: "variable.other"
|
||||
},
|
||||
{
|
||||
foreground: "33969f",
|
||||
background: "05d6f9",
|
||||
fontStyle: "italic",
|
||||
token: "variable.parameter",
|
||||
token: "variable.parameter"
|
||||
},
|
||||
{
|
||||
foreground: "674aa8",
|
||||
background: "a3aad8",
|
||||
token: "keyword",
|
||||
token: "keyword"
|
||||
},
|
||||
{
|
||||
foreground: "b9986f",
|
||||
background: "b998df",
|
||||
fontStyle: "bold",
|
||||
token: "entity.name.class",
|
||||
token: "entity.name.class"
|
||||
},
|
||||
{
|
||||
foreground: "22af9d",
|
||||
background: "b998df",
|
||||
token: "entity.name.structure",
|
||||
token: "entity.name.structure"
|
||||
},
|
||||
{
|
||||
foreground: "af47a9",
|
||||
background: "af77a9",
|
||||
token: "entity.name.type",
|
||||
token: "entity.name.type"
|
||||
},
|
||||
{
|
||||
foreground: "cc4357",
|
||||
background: "ffddff",
|
||||
token: "entity.name.class",
|
||||
token: "entity.name.class"
|
||||
},
|
||||
{
|
||||
foreground: "cc4357",
|
||||
background: "ffddff",
|
||||
token: "entity.name.type.class",
|
||||
token: "entity.name.type.class"
|
||||
},
|
||||
{
|
||||
foreground: "ef6aa7",
|
||||
background: "ef6aa7",
|
||||
token: "support.class",
|
||||
token: "support.class"
|
||||
},
|
||||
{
|
||||
foreground: "dfdfd5",
|
||||
background: "cc1b27",
|
||||
token: "invalid",
|
||||
token: "invalid"
|
||||
},
|
||||
{
|
||||
foreground: "13499f",
|
||||
background: "0099ff",
|
||||
fontStyle: "italic",
|
||||
token: "string source",
|
||||
token: "string source"
|
||||
},
|
||||
{
|
||||
foreground: "3976a2",
|
||||
background: "49a6d2",
|
||||
token: "entity.name.tag",
|
||||
token: "entity.name.tag"
|
||||
},
|
||||
{
|
||||
foreground: "4946c2",
|
||||
background: "4986c2",
|
||||
token: "entity.other.attribute-name",
|
||||
},
|
||||
token: "entity.other.attribute-name"
|
||||
}
|
||||
],
|
||||
colors: {
|
||||
"editor.foreground": "#0f0009",
|
||||
@@ -169,8 +169,8 @@ export const lightEditor: editor.IStandaloneThemeData = {
|
||||
"editor.lineHighlightBackground": "#ffffff",
|
||||
"editorCursor.foreground": "#100011",
|
||||
"editorWhitespace.foreground": "#000000",
|
||||
"editor.selectionHighlightBorder": "#B3B3B3",
|
||||
},
|
||||
"editor.selectionHighlightBorder": "#B3B3B3"
|
||||
}
|
||||
};
|
||||
|
||||
export const darkEditor: editor.IStandaloneThemeData = {
|
||||
@@ -179,128 +179,128 @@ export const darkEditor: editor.IStandaloneThemeData = {
|
||||
rules: [
|
||||
{
|
||||
foreground: "75715e",
|
||||
token: "comment",
|
||||
token: "comment"
|
||||
},
|
||||
{
|
||||
foreground: "e6db74",
|
||||
token: "string",
|
||||
token: "string"
|
||||
},
|
||||
{
|
||||
foreground: "ae81ff",
|
||||
token: "constant.numeric",
|
||||
token: "constant.numeric"
|
||||
},
|
||||
{
|
||||
foreground: "ae81ff",
|
||||
token: "constant.language",
|
||||
token: "constant.language"
|
||||
},
|
||||
{
|
||||
foreground: "ae81ff",
|
||||
token: "constant.character",
|
||||
token: "constant.character"
|
||||
},
|
||||
{
|
||||
foreground: "ae81ff",
|
||||
token: "constant.other",
|
||||
token: "constant.other"
|
||||
},
|
||||
{
|
||||
foreground: "f92672",
|
||||
token: "keyword",
|
||||
token: "keyword"
|
||||
},
|
||||
{
|
||||
foreground: "f92672",
|
||||
token: "storage",
|
||||
token: "storage"
|
||||
},
|
||||
{
|
||||
foreground: "66d9ef",
|
||||
fontStyle: "italic",
|
||||
token: "storage.type",
|
||||
token: "storage.type"
|
||||
},
|
||||
{
|
||||
foreground: "a6e22e",
|
||||
fontStyle: "underline",
|
||||
token: "entity.name.class",
|
||||
token: "entity.name.class"
|
||||
},
|
||||
{
|
||||
foreground: "a6e22e",
|
||||
fontStyle: "italic underline",
|
||||
token: "entity.other.inherited-class",
|
||||
token: "entity.other.inherited-class"
|
||||
},
|
||||
{
|
||||
foreground: "a6e22e",
|
||||
token: "entity.name.function",
|
||||
token: "entity.name.function"
|
||||
},
|
||||
{
|
||||
foreground: "fd971f",
|
||||
fontStyle: "italic",
|
||||
token: "variable.parameter",
|
||||
token: "variable.parameter"
|
||||
},
|
||||
{
|
||||
foreground: "f92672",
|
||||
token: "entity.name.tag",
|
||||
token: "entity.name.tag"
|
||||
},
|
||||
{
|
||||
foreground: "a6e22e",
|
||||
token: "entity.other.attribute-name",
|
||||
token: "entity.other.attribute-name"
|
||||
},
|
||||
{
|
||||
foreground: "66d9ef",
|
||||
token: "support.function",
|
||||
token: "support.function"
|
||||
},
|
||||
{
|
||||
foreground: "66d9ef",
|
||||
token: "support.constant",
|
||||
token: "support.constant"
|
||||
},
|
||||
{
|
||||
foreground: "66d9ef",
|
||||
fontStyle: "italic",
|
||||
token: "support.type",
|
||||
token: "support.type"
|
||||
},
|
||||
{
|
||||
foreground: "66d9ef",
|
||||
fontStyle: "italic",
|
||||
token: "support.class",
|
||||
token: "support.class"
|
||||
},
|
||||
{
|
||||
foreground: "f8f8f0",
|
||||
background: "f92672",
|
||||
token: "invalid",
|
||||
token: "invalid"
|
||||
},
|
||||
{
|
||||
foreground: "f8f8f0",
|
||||
background: "ae81ff",
|
||||
token: "invalid.deprecated",
|
||||
token: "invalid.deprecated"
|
||||
},
|
||||
{
|
||||
foreground: "cfcfc2",
|
||||
token: "meta.structure.dictionary.json string.quoted.double.json",
|
||||
token: "meta.structure.dictionary.json string.quoted.double.json"
|
||||
},
|
||||
{
|
||||
foreground: "75715e",
|
||||
token: "meta.diff",
|
||||
token: "meta.diff"
|
||||
},
|
||||
{
|
||||
foreground: "75715e",
|
||||
token: "meta.diff.header",
|
||||
token: "meta.diff.header"
|
||||
},
|
||||
{
|
||||
foreground: "f92672",
|
||||
token: "markup.deleted",
|
||||
token: "markup.deleted"
|
||||
},
|
||||
{
|
||||
foreground: "a6e22e",
|
||||
token: "markup.inserted",
|
||||
token: "markup.inserted"
|
||||
},
|
||||
{
|
||||
foreground: "e6db74",
|
||||
token: "markup.changed",
|
||||
token: "markup.changed"
|
||||
},
|
||||
{
|
||||
foreground: "ae81ff",
|
||||
token: "constant.numeric.line-number.find-in-files - match",
|
||||
token: "constant.numeric.line-number.find-in-files - match"
|
||||
},
|
||||
{
|
||||
foreground: "e6db74",
|
||||
token: "entity.name.filename.find-in-files",
|
||||
},
|
||||
token: "entity.name.filename.find-in-files"
|
||||
}
|
||||
],
|
||||
colors: {
|
||||
"editor.foreground": "#F8F8F2",
|
||||
@@ -310,6 +310,6 @@ export const darkEditor: editor.IStandaloneThemeData = {
|
||||
"editorCursor.foreground": "#F8F8F0",
|
||||
"editorWhitespace.foreground": "#3B3A32",
|
||||
"editorIndentGuide.activeBackground": "#9D550F",
|
||||
"editor.selectionHighlightBorder": "#222218",
|
||||
},
|
||||
"editor.selectionHighlightBorder": "#222218"
|
||||
}
|
||||
};
|
||||
@@ -9,9 +9,9 @@ function sendMsg(payload, worker: Worker) {
|
||||
const msgId = globalMsgId++;
|
||||
const msg = {
|
||||
id: msgId,
|
||||
payload,
|
||||
payload
|
||||
};
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
// save callbacks for later
|
||||
resolves[msgId] = resolve;
|
||||
rejects[msgId] = reject;
|
||||
|
||||
Reference in new issue
Block a user