upgrade dependencies (#184)

* upgrade dependencies

* upgrade dependencies

* format code

* update nextjs

* fixes

* chore: update graphql generator

* fixes

* fixes

* fixes
This commit is contained in:
Ritesh Kumar authored and GitHub committed 2020-06-06 03:50:58 +05:30
1 parent b69461b66e
commit 618bd8d5bc
88 files changed
+3427 -3350

No files matched your search

-20
View File
@@ -1,20 +0,0 @@
{
"presets": [
"next/babel"
],
"plugins": [
["module-resolver", {
"root": ["."],
"alias": {
"@components": "./components",
"@styles": "./styles",
"@utils": "./utils",
"@workers": "./workers",
"@typings": "./typings",
"@assets": "./assets",
"@constants": "./constants",
"@hooks": "./hooks"
}
}]
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
import React from "react";
export default function() {
export default function () {
return (
<svg
data-name="Layer 1"
+1 -1
View File
@@ -1,6 +1,6 @@
import React from "react";
export default function() {
export default function () {
return (
<svg
data-name="Layer 1"
+2 -2
View File
@@ -1,6 +1,6 @@
import React from "react";
export default function() {
export default function () {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -12,7 +12,7 @@ export default function() {
xmlSpace="preserve"
height={20}
style={{
marginRight: 10
marginRight: 10,
}}
>
<style dangerouslySetInnerHTML={{ __html: ".st0{fill:#C12127;}" }} />
+8 -10
View File
@@ -12,7 +12,7 @@ let prettierWorker;
function getEditorLanguage(lang: Language) {
const mapping = {
flow: "typescript"
flow: "typescript",
};
return mapping[lang] || lang;
@@ -42,9 +42,7 @@ export interface ConversionPanelProps {
settings?: any;
}
const ConversionPanel: React.FunctionComponent<
ConversionPanelProps
> = function({
const ConversionPanel: React.FunctionComponent<ConversionPanelProps> = function ({
splitEditorProps,
editorProps,
resultEditorProps,
@@ -59,7 +57,7 @@ const ConversionPanel: React.FunctionComponent<
settings,
editorDefaultValue,
splitEditorDefaultValue,
resultSettingsElement
resultSettingsElement,
}) {
const [value, setValue] = useData(editorDefaultValue || editorLanguage);
const [splitValue, setSplitValue] = useData(
@@ -81,7 +79,7 @@ const ConversionPanel: React.FunctionComponent<
packageName && packageUrl
? {
name: packageName,
url: packageUrl
url: packageUrl,
}
: undefined;
}
@@ -94,12 +92,12 @@ const ConversionPanel: React.FunctionComponent<
const result = await transformer({
value,
splitEditorValue: splitTitle ? splitValue : undefined
splitEditorValue: splitTitle ? splitValue : undefined,
});
const prettyResult = await prettierWorker.send({
value: result,
language: resultLanguage
language: resultLanguage,
});
setResult(prettyResult);
setMessage("");
@@ -174,8 +172,8 @@ const ConversionPanel: React.FunctionComponent<
<Spinner
css={{
"& circle": {
stroke: "#0e7ccf"
}
stroke: "#0e7ccf",
},
}}
size={32}
/>
+18 -18
View File
@@ -11,7 +11,7 @@ import {
Spinner,
TextInput,
toaster,
Tooltip
Tooltip,
} from "evergreen-ui";
import React, { useCallback, useEffect, useRef, useState } from "react";
import dynamic from "next/dynamic";
@@ -64,10 +64,10 @@ const Monaco = dynamic(() => import("../components/Monaco"), {
>
<Spinner />
</Pane>
)
),
});
export default function({
export default function ({
editable = true,
title,
settingElement,
@@ -82,7 +82,7 @@ export default function({
defaultValue,
onChange,
id,
packageDetails
packageDetails,
}: EditorPanelProps) {
const [showSettingsDialogue, setSettingsDialog] = useState(false);
const [showPreview, setPreviewVisibility] = useState(true);
@@ -96,10 +96,10 @@ export default function({
codeLens: false,
fontFamily: "Menlo, Consolas, monospace, sans-serif",
minimap: {
enabled: false
enabled: false,
},
quickSuggestions: false,
lineNumbers: "on"
lineNumbers: "on",
};
const _toggleSettingsDialog = useCallback(
@@ -126,7 +126,7 @@ export default function({
{settingElement({
toggle: _toggleSettingsDialog,
open: showSettingsDialogue
open: showSettingsDialogue,
})}
</>
),
@@ -146,19 +146,19 @@ export default function({
}, []);
const { getRootProps } = useDropzone({
onDrop: files => onFilePicked(files),
onDrop: (files) => onFilePicked(files),
disabled: !editable,
accept: acceptFiles,
onDropRejected: () =>
toaster.danger("This file type is not supported.", {
id
})
id,
}),
});
const copyValue = useCallback(() => {
copy(value);
toaster.success("Copied to clipboard.", {
id
id,
});
}, [value]);
@@ -166,7 +166,7 @@ export default function({
prettierWorker
.send({
language,
value
value,
})
.then(setValue);
}, [language, value]);
@@ -176,7 +176,7 @@ export default function({
}, [showPreview]);
const fetchFile = useCallback(
close => {
(close) => {
(async () => {
if (!fetchingUrl) return;
const res = await fetch(fetchingUrl);
@@ -229,7 +229,7 @@ export default function({
<FilePicker
width={"100%"}
name="filepicker"
onChange={files => onFilePicked(files, close)}
onChange={(files) => onFilePicked(files, close)}
accept={acceptFiles}
/>
@@ -293,7 +293,7 @@ export default function({
<a
href={packageDetails.url}
style={{
display: "inline-flex"
display: "inline-flex",
}}
target="_blank"
>
@@ -327,21 +327,21 @@ export default function({
display: "flex",
flexDirection: "column",
flex: 1,
overflow: "hidden"
overflow: "hidden",
}}
{...getRootProps()}
>
{topNotifications &&
topNotifications({
isSettingsOpen: showSettingsDialogue,
toggleSettings: _toggleSettingsDialog
toggleSettings: _toggleSettingsDialog,
})}
<Monaco
language={language}
value={value}
options={options}
onChange={value => {
onChange={(value) => {
setValue(value);
onChange(value);
}}
+5 -5
View File
@@ -5,7 +5,7 @@ import { Dialog, Heading, Pane, Switch, TextInput, Select } from "evergreen-ui";
export enum InputType {
SWITCH = 1,
TEXT_INPUT,
SELECT
SELECT,
}
interface FormProps<T> {
@@ -30,7 +30,7 @@ const Form = <T extends object>({
title,
formsFields,
open,
toggle
toggle,
}: FormProps<T> & { children?: React.ReactNode }) => {
return (
<Formik
@@ -41,11 +41,11 @@ const Form = <T extends object>({
title={title}
isShown={open}
onCloseComplete={toggle}
onConfirm={close => {
onConfirm={(close) => {
props.submitForm();
close();
}}
onCancel={close => {
onCancel={(close) => {
props.resetForm();
close();
}}
@@ -120,7 +120,7 @@ const Form = <T extends object>({
</Dialog>
);
}}
onSubmit={values => {
onSubmit={(values) => {
onSubmit(values);
}}
/>
+7 -7
View File
@@ -5,12 +5,12 @@ import { lightEditor } from "@utils/theme";
languages.typescript.typescriptDefaults.setDiagnosticsOptions({
noSemanticValidation: true,
noSyntaxValidation: true
noSyntaxValidation: true,
});
// @ts-ignore
self.MonacoEnvironment = {
getWorkerUrl: function(_moduleId, label) {
getWorkerUrl: function (_moduleId, label) {
if (label === "json") {
return `/static/monaco/json.worker.js`;
}
@@ -24,7 +24,7 @@ self.MonacoEnvironment = {
return `/static/monaco/typescript.worker.js`;
}
return `/static/monaco/editor.worker.js`;
}
},
};
function noop() {}
@@ -57,7 +57,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
language: "javascript",
options: {},
editorDidMount: noop,
theme: "light"
theme: "light",
};
public reLayout = () => {
@@ -115,7 +115,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
this.editor = editor.create(this.containerElement.current, {
value,
language,
...options
...options,
});
editor.defineTheme("light", lightEditor);
@@ -130,7 +130,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
editorDidMount(editor) {
this.props.editorDidMount(editor);
editor.onDidChangeModelContent(event => {
editor.onDidChangeModelContent((event) => {
const value = editor.getValue();
// Only invoking when user input changed
@@ -146,7 +146,7 @@ export class MonacoEditor extends React.PureComponent<MonacoProps> {
const fixedHeight = processSize(height);
const style = {
width: fixedWidth,
height: fixedHeight
height: fixedHeight,
};
return (
+6 -6
View File
@@ -6,13 +6,13 @@ import { useRouter } from "next/router";
import SearchBox from "@components/Searchbox";
import loadScript from "load-script";
export default function() {
export default function () {
const router = useRouter();
useEffect(() => {
if (!IS_DEV)
loadScript("https://codefund.io/properties/367/funder.js", {
async: true
async: true,
});
}, []);
@@ -36,7 +36,7 @@ export default function() {
flexDirection="column"
paddingBottom={10}
>
{categorizedRoutes.map(route => {
{categorizedRoutes.map((route) => {
return (
<Fragment key={route.category}>
<Pane paddingX={10} marginTop={15} marginBottom={2}>
@@ -53,7 +53,7 @@ export default function() {
<Link key={a.label} href={a.path} prefetch={false}>
<a
style={{
textDecoration: "none"
textDecoration: "none",
}}
>
<Pane
@@ -67,8 +67,8 @@ export default function() {
}
css={{
"&:hover": {
backgroundColor: "#f5f5f5"
}
backgroundColor: "#f5f5f5",
},
}}
>
<Text fontSize={13}>{a.label}</Text>
+4 -4
View File
@@ -6,18 +6,18 @@ import { useRouter } from "next/router";
const SearchBox: React.FunctionComponent<{}> = () => {
const router = useRouter();
const onSearchSelect = useCallback(changedItem => {
const route = routes.find(route => changedItem === route.searchTerm);
const onSearchSelect = useCallback((changedItem) => {
const route = routes.find((route) => changedItem === route.searchTerm);
router.push(route.path);
}, []);
return (
<Autocomplete
onChange={onSearchSelect}
items={routes.map(a => a.searchTerm)}
items={routes.map((a) => a.searchTerm)}
width="100%"
>
{props => {
{(props) => {
const { getInputProps, getRef, inputValue } = props;
return (
<SearchInput
+5 -5
View File
@@ -23,7 +23,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
formFields,
optimizedValue,
settings,
setSettings
setSettings,
}) => {
const getSettingsPanel = useCallback<EditorPanelProps["settingElement"]>(
({ open, toggle }) => {
@@ -73,14 +73,14 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
}
/>
),
previewElement: value => (
previewElement: (value) => (
<Pane display="flex" flexDirection="row" flex={1}>
<Pane display={"flex"} flex={1} position="relative">
<img
style={{
flex: 1,
width: "100%",
borderRight: "1px solid #eee"
borderRight: "1px solid #eee",
}}
src={svgToDataUrl(value)}
alt="original"
@@ -101,7 +101,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
<img
style={{
flex: 1,
width: "100%"
width: "100%",
}}
src={svgToDataUrl(optimizedValue)}
alt="optimized"
@@ -120,7 +120,7 @@ export const SvgConverter: React.FunctionComponent<SvgConverterProps> = ({
</Pane>
</Pane>
),
acceptFiles: "image/svg+xml"
acceptFiles: "image/svg+xml",
}}
/>
);
+1 -1
View File
@@ -1,5 +1,5 @@
export enum BabelTransforms {
JSON_TO_PROPTYPES = 1,
OBJECT_STYLES_TO_TEMPLATE,
JSON_TO_MOBX_TREE
JSON_TO_MOBX_TREE,
}
+1 -1
View File
@@ -3,7 +3,7 @@ export const json = JSON.stringify(
userId: 1,
id: 1,
title: "delectus aut autem",
completed: false
completed: false,
},
null,
2
+1 -1
View File
@@ -12,5 +12,5 @@ export enum GraphqlTransforms {
TO_TYPESCRIPT_RESOLVERS_SIGNATURE,
TO_FLOW_RESOLVERS_SIGNATURE,
TO_URQL,
TO_TYPESCRIPT_MONGODB
TO_TYPESCRIPT_MONGODB,
}
+6 -6
View File
@@ -40,7 +40,7 @@ export const nativeRequiredSettings = {
removeXMLProcInst: false,
removeComments: true,
removeMetadata: true,
removeDimensions: false
removeDimensions: false,
};
export const defaultSettings = {
@@ -73,7 +73,7 @@ export const defaultSettings = {
removeRasterImages: true,
mergePaths: true,
convertShapeToPath: true,
sortAttrs: true
sortAttrs: true,
};
export const defaultNativeSettings = omit(
@@ -81,15 +81,15 @@ export const defaultNativeSettings = omit(
Object.keys(nativeRequiredSettings)
);
export const formFields = settings =>
export const formFields = (settings) =>
Object.keys(settings).map((property: keyof Settings) => ({
label: lowerCase(property),
type: InputType.SWITCH,
key: property,
...(property !== "optimizeSvg"
? {
isDisabled: values => !values.optimizeSvg,
props: { paddingLeft: 20, borderLeft: "2px solid #FDF8F3" }
isDisabled: (values) => !values.optimizeSvg,
props: { paddingLeft: 20, borderLeft: "2px solid #FDF8F3" },
}
: {})
: {}),
}));
+1 -1
View File
@@ -22,7 +22,7 @@ export function useLocalStorage(key, initialValue) {
// Return a wrapped version of useState's setter function that ...
// ... persists the new value to sessionStorage.
const setValue = value => {
const setValue = (value) => {
try {
// Allow value to be a function so we have same API as useState
const valueToStore =
+1 -1
View File
@@ -24,7 +24,7 @@ export function useSessionStorage(key, initialValue) {
// Return a wrapped version of useState's setter function that ...
// ... persists the new value to sessionStorage.
const setValue = value => {
const setValue = (value) => {
try {
// Allow value to be a function so we have same API as useState
const valueToStore =
+5 -5
View File
@@ -1,9 +1,6 @@
const withCSS = require("@zeit/next-css");
const webpack = require("webpack");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true"
});
const config = {
webpack(config, options) {
@@ -68,7 +65,10 @@ const config = {
return config;
},
target: "serverless"
target: "serverless",
experimental: {
jsConfig: true
}
};
module.exports = withBundleAnalyzer(withCSS(config));
module.exports = withCSS(config);
-3
View File
@@ -1,8 +1,5 @@
{
"version": 2,
"name": "transform",
"alias": "transform.tools",
"builds": [{ "src": "next.config.js", "use": "@now/next" }],
"routes": [
{
"src": "/svg-to-jsx",
+31 -37
View File
@@ -15,28 +15,29 @@
"build:analyze": "ANALYZE=true yarn build"
},
"engines": {
"node": "10.x"
"node": "12.x"
},
"dependencies": {
"@babel/standalone": "^7.5.5",
"@graphql-codegen/core": "^1.4.0",
"@graphql-codegen/flow": "^1.4.0",
"@graphql-codegen/flow-operations": "^1.4.0",
"@graphql-codegen/flow-resolvers": "^1.4.0",
"@graphql-codegen/fragment-matcher": "^1.4.0",
"@graphql-codegen/introspection": "^1.4.0",
"@graphql-codegen/java": "^1.4.0",
"@graphql-codegen/java-resolvers": "^1.4.0",
"@graphql-codegen/schema-ast": "^1.4.0",
"@graphql-codegen/typescript": "^1.4.0",
"@graphql-codegen/typescript-apollo-angular": "^1.4.0",
"@graphql-codegen/typescript-mongodb": "^1.4.0",
"@graphql-codegen/typescript-operations": "^1.4.0",
"@graphql-codegen/typescript-react-apollo": "^1.4.0",
"@graphql-codegen/typescript-resolvers": "^1.4.0",
"@graphql-codegen/typescript-stencil-apollo": "^1.4.0",
"@graphql-codegen/typescript-urql": "^1.4.0",
"@graphql-codegen/core": "^1.15.1",
"@graphql-codegen/flow": "^1.15.1",
"@graphql-codegen/flow-operations": "^1.15.1",
"@graphql-codegen/flow-resolvers": "^1.15.1",
"@graphql-codegen/fragment-matcher": "^1.15.1",
"@graphql-codegen/introspection": "^1.15.1",
"@graphql-codegen/java": "^1.15.1",
"@graphql-codegen/java-resolvers": "^1.15.1",
"@graphql-codegen/schema-ast": "^1.15.1",
"@graphql-codegen/typescript": "^1.15.1",
"@graphql-codegen/typescript-apollo-angular": "^1.15.1",
"@graphql-codegen/typescript-mongodb": "^1.15.1",
"@graphql-codegen/typescript-operations": "^1.15.1",
"@graphql-codegen/typescript-react-apollo": "^1.15.1",
"@graphql-codegen/typescript-resolvers": "^1.15.1",
"@graphql-codegen/typescript-stencil-apollo": "^1.15.1",
"@graphql-codegen/typescript-urql": "^1.15.1",
"@khanacademy/flow-to-ts": "^0.1.6",
"@openapi-contrib/json-schema-to-openapi-schema": "^1.1.0",
"@svgr/core": "^5.4.0",
"@svgr/plugin-jsx": "^5.4.0",
"@types/jsonld": "^1.5.1",
@@ -45,18 +46,16 @@
"babel-plugin-object-styles-to-template": "^0.2.2",
"babel-standalone": "^6.26.0",
"clipboard-copy": "^3.1.0",
"evergreen-ui": "^4.18.1",
"evergreen-ui": "^4.27.4",
"flowgen": "^1.10.0",
"formik": "^1.5.8",
"formik": "^2.1.4",
"generate-schema": "^2.6.0",
"gofmt.js": "^0.0.2",
"graphql": "^14.4.2",
"graphql-tools": "^4.0.5",
"graphql": "^15.0.0",
"html2pug": "^4.0.0",
"htmltojsx": "^0.3.0",
"is-capitalized": "^1.0.0",
"is-svg": "^4.2.1",
"json-schema-to-openapi-schema": "^0.3.0",
"json-schema-to-typescript": "^9.1.0",
"json-to-go": "gist:0d0b8324131c80eeb7e1df20001be32f",
"json-ts": "^1.6.4",
@@ -66,14 +65,15 @@
"lodash": "^4.17.15",
"markdown": "^0.5.0",
"monaco-editor": "0.17.1",
"next": "9.1.1",
"next": "9.4.4",
"nprogress": "^0.2.0",
"postcss": "^7.0.32",
"postcss-js": "^2.0.3",
"prettier": "^1.18.2",
"qrcode.react": "^1.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-dropzone": "^10.2.1",
"react-dropzone": "^11.0.1",
"react-ga": "^2.7.0",
"rust-keywords": "^1.1.0",
"sha1": "^1.1.1",
@@ -84,29 +84,24 @@
"tempy": "^0.5.0",
"text-encoding-utf-8": "^1.0.2",
"transform-json-types": "^0.7.0",
"ts-json-schema-generator": "^0.70.0",
"ts-json-schema-generator": "^0.70.1",
"typescript": "3.9.5",
"xml-js": "^1.6.11",
"yaml": "^1.7.2"
"yaml": "^1.10.0"
},
"devDependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.7.4",
"@next/bundle-analyzer": "^9.0.2",
"@now/node": "^0.12.0",
"@types/lodash": "^4.14.155",
"@types/prettier": "^1.18.0",
"@types/react": "^16.8.23",
"@types/svgo": "^1.3.3",
"@zeit/next-css": "^1.0.1",
"babel-plugin-module-resolver": "^3.2.0",
"husky": "^3.0.1",
"husky": "^4.2.5",
"imagemin-lint-staged": "^0.4.0",
"lint-staged": "^9.2.1",
"lint-staged": "^10.2.9",
"monaco-editor-webpack-plugin": "^1.7.0",
"patch-package": "^6.1.2",
"postinstall-postinstall": "^2.0.0",
"prettier": "^1.18.2",
"pretty-quick": "^1.11.1",
"pretty-quick": "^2.0.1",
"ui-box": "2.1.0",
"webpack": "^4.38.0",
"worker-loader": "^2.0.0"
@@ -118,8 +113,7 @@
},
"lint-staged": {
"./assets/*/*.svg": [
"imagemin-lint-staged",
"git add"
"imagemin-lint-staged"
]
}
}
+6 -6
View File
@@ -21,7 +21,7 @@ const logo = (
height="19px"
viewBox="0 0 306 62"
style={{
marginTop: -4
marginTop: -4,
}}
>
<path
@@ -41,10 +41,10 @@ function renderHeadWay() {
const HW_config = {
selector: ".transform-changelog", // CSS selector where to inject the badge
account: "J0B24x",
trigger: ".transform-changelog"
trigger: ".transform-changelog",
};
(function(src) {
(function (src) {
const tag = document.createElement("script");
tag.async = false;
tag.src = src;
@@ -60,7 +60,7 @@ function renderHeadWay() {
export default class extends App {
timer: any;
private stopProgress = pathname => {
private stopProgress = (pathname) => {
reactGa && reactGa.pageview(pathname);
clearTimeout(this.timer);
NProgress.done();
@@ -126,7 +126,7 @@ export default class extends App {
height={40}
className="transform-changelog"
css={{
color: "#fff !important"
color: "#fff !important",
}}
>
Changelog
@@ -136,7 +136,7 @@ export default class extends App {
appearance="minimal"
height={40}
css={{
color: "#fff !important"
color: "#fff !important",
}}
>
GitHub
+1 -1
View File
@@ -15,7 +15,7 @@ export default class MyDocument extends Document<DocumentProps> {
return {
...page,
css,
hydrationScript
hydrationScript,
};
}
+2 -2
View File
@@ -21,12 +21,12 @@ export default (req: NextApiRequest, res: NextApiResponse) => {
emitDeclarationOnly: true,
jsx: ts.JsxEmit.React,
skipDefaultLibCheck: true,
skipLibCheck: true
skipLibCheck: true,
};
const host = ts.createCompilerHost(options);
host.getSourceFile = filename => {
host.getSourceFile = (filename) => {
if (filename === "file.ts") {
return ts.createSourceFile(filename, tsCode, undefined);
}
+1 -1
View File
@@ -10,7 +10,7 @@ export default (req: NextApiRequest, res: NextApiResponse) => {
path: filePath,
expose: "all",
jsDoc: "extended",
type: "*"
type: "*",
};
const schema = tsj.createGenerator(config).createSchema(config.type);
+3 -3
View File
@@ -5,13 +5,13 @@ import PostCssWorker from "@workers/postcss.worker";
import { useSettings } from "@hooks/useSettings";
let postCssWorker;
export default function() {
export default function () {
const name = "CSS to JS";
// TODO
const [settings, setSettings] = useSettings(name, {
reactNativeCompatible: false,
cleanPropertyNames: false
cleanPropertyNames: false,
});
const transformer = useCallback<Transformer>(async ({ value }) => {
@@ -29,7 +29,7 @@ export default function() {
editorLanguage="css"
resultLanguage="javascript"
editorProps={{
acceptFiles: "text/css"
acceptFiles: "text/css",
}}
/>
);
+3 -3
View File
@@ -4,12 +4,12 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function() {
export default function () {
const transformer = useCallback(
({ value }) =>
request("/api/flow-to-typescript", {
value,
declarationOnly: true
declarationOnly: true,
}),
[]
);
@@ -28,7 +28,7 @@ export default function() {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
)
),
}}
/>
);
+3 -3
View File
@@ -4,12 +4,12 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function() {
export default function () {
const transformer = useCallback(
({ value }) =>
request("/api/flow-to-typescript", {
value,
declarationOnly: false
declarationOnly: false,
}),
[]
);
@@ -28,7 +28,7 @@ export default function() {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
)
),
}}
/>
);
+4 -4
View File
@@ -9,10 +9,10 @@ import { Select } from "evergreen-ui";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const [output, setOutput] = useState(
GraphqlTransforms.TO_REACT_APOLLO.toString(10)
);
@@ -24,7 +24,7 @@ export default function() {
return graphqlWorker.send({
type: parseInt(output, 10),
value,
document: splitEditorValue
document: splitEditorValue,
});
},
[output]
@@ -35,7 +35,7 @@ export default function() {
settings={output}
transformer={transformer}
resultTitle={
<Select value={output} onChange={e => setOutput(e.target.value)}>
<Select value={output} onChange={(e) => setOutput(e.target.value)}>
<option value={GraphqlTransforms.TO_REACT_APOLLO}>
TypeScript React Apollo
</option>
+3 -3
View File
@@ -8,10 +8,10 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
@@ -19,7 +19,7 @@ export default function() {
return graphqlWorker.send({
type: GraphqlTransforms.TO_FLOW,
value,
document: splitEditorValue
document: splitEditorValue,
});
},
[]
+3 -3
View File
@@ -8,16 +8,16 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_FRAGMENT_MATCHER,
value
value,
});
}, []);
+3 -3
View File
@@ -8,17 +8,17 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker, prettierWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_INTROSPECTION_JSON,
value,
extension: "json"
extension: "json",
});
}, []);
+3 -3
View File
@@ -8,16 +8,16 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_JAVA,
value
value,
});
}, []);
+5 -5
View File
@@ -9,16 +9,16 @@ import { Select } from "evergreen-ui";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
const langMap = {
[GraphqlTransforms.TO_FLOW_RESOLVERS_SIGNATURE]: "flow",
[GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE]: "typescript",
[GraphqlTransforms.TO_JAVA_RESOLVERS_SIGNATURE]: "java"
[GraphqlTransforms.TO_JAVA_RESOLVERS_SIGNATURE]: "java",
};
export default function() {
export default function () {
const [output, setOutput] = useState(
GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE.toString(10)
);
@@ -34,7 +34,7 @@ export default function() {
output ===
GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE.toString(10)
? splitEditorValue
: undefined
: undefined,
});
},
[output]
@@ -45,7 +45,7 @@ export default function() {
settings={output}
transformer={transformer}
resultTitle={
<Select value={output} onChange={e => setOutput(e.target.value)}>
<Select value={output} onChange={(e) => setOutput(e.target.value)}>
<option value={GraphqlTransforms.TO_TYPESCRIPT_RESOLVERS_SIGNATURE}>
TypeScript Resolvers Signature
</option>
+3 -3
View File
@@ -8,17 +8,17 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_SCHEMA_AST,
value,
extension: "graphql"
extension: "graphql",
});
}, []);
+3 -3
View File
@@ -8,17 +8,17 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
return graphqlWorker.send({
type: GraphqlTransforms.TO_TYPESCRIPT_MONGODB,
value,
extension: "ts"
extension: "ts",
});
}, []);
+3 -3
View File
@@ -8,10 +8,10 @@ import { GraphqlTransforms } from "@constants/graphqlTransforms";
let graphqlWorker;
const props = {
acceptFiles: ".graphql, .gql"
acceptFiles: ".graphql, .gql",
};
export default function() {
export default function () {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
graphqlWorker = graphqlWorker || getWorker(GrapqlWorker);
@@ -19,7 +19,7 @@ export default function() {
return graphqlWorker.send({
type: GraphqlTransforms.TO_TYPESCRIPT,
value,
document: splitEditorValue
document: splitEditorValue,
});
},
[]
+6 -8
View File
@@ -18,21 +18,21 @@ const formFields = [
{
type: InputType.SWITCH,
key: "createClass",
label: "Create Class"
label: "Create Class",
},
{
type: InputType.TEXT_INPUT,
key: "outputClassName",
label: "Output Class Name"
}
label: "Output Class Name",
},
];
export default function() {
export default function () {
const name = "HTML to JSX";
const [settings, setSettings] = useSettings(name, {
createClass: false,
outputClassName: "TransformedComponent"
outputClassName: "TransformedComponent",
});
const [_isSvg, setSvg] = useState(false);
@@ -92,9 +92,7 @@ export default function() {
</>
}
/>
) : (
undefined
)
) : undefined,
}}
/>
);
+8 -8
View File
@@ -9,33 +9,33 @@ const formFields = [
{
key: "tabs",
type: InputType.SWITCH,
label: "Use Tabs"
label: "Use Tabs",
},
{
key: "commas",
type: InputType.SWITCH,
label: "Commas"
label: "Commas",
},
{
key: "doubleQuotes",
type: InputType.SWITCH,
label: "Use double quotes"
label: "Use double quotes",
},
{
key: "fragment",
type: InputType.SWITCH,
label: "Use Fragment"
}
label: "Use Fragment",
},
];
const defaultSettings = {
tabs: true,
commas: true,
doubleQuotes: false,
fragment: false
fragment: false,
};
export default function() {
export default function () {
const name = "HTML to Pug";
const [settings, setSettings] = useSettings(name, defaultSettings);
@@ -57,7 +57,7 @@ export default function() {
({ value }) =>
request("/api/html-to-pug", {
value,
settings
settings,
}),
[settings]
);
+3 -3
View File
@@ -10,7 +10,7 @@ import SvgrWorker from "@workers/svgr.worker";
import SvgoWorker from "@workers/svgo.worker";
let prettier, svgo, svgr;
export default function() {
export default function () {
const name = "SVG to JSX";
const [settings, setSettings] = useState(defaultSettings);
const [optimizedValue, setOptimizedValue] = useState("");
@@ -27,14 +27,14 @@ export default function() {
if (settings.optimizeSvg) {
_value = await svgo.send({
value,
settings
settings,
});
}
setOptimizedValue(_value);
_value = await svgr.send({
value: _value
value: _value,
});
return _value;
+1 -1
View File
@@ -2,7 +2,7 @@ import ConversionPanel from "@components/ConversionPanel";
import { useCallback } from "react";
import * as React from "react";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(eval("(" + value + ")"), null, 2);
}, []);
+3 -3
View File
@@ -1,14 +1,14 @@
import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
import toOpenApi from "json-schema-to-openapi-schema";
import toOpenApi from "@openapi-contrib/json-schema-to-openapi-schema";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(
async ({ value }) =>
JSON.stringify(
toOpenApi(JSON.parse(value), {
cloneSchema: true
cloneSchema: true,
}),
null,
2
+2 -2
View File
@@ -3,10 +3,10 @@ import * as React from "react";
import { useCallback } from "react";
import { compile } from "json-schema-to-typescript";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return compile(JSON.parse(value), "MySchema", {
bannerComment: ""
bannerComment: "",
});
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import gs from "generate-schema";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(gs.bigquery(JSON.parse(value)), null, 2);
}, []);
+6 -6
View File
@@ -11,27 +11,27 @@ const formFields = [
{
type: InputType.TEXT_INPUT,
key: "namespace",
label: "Namespace"
label: "Namespace",
},
{
type: InputType.TEXT_INPUT,
key: "prefix",
label: "prefix"
label: "prefix",
},
{
type: InputType.TEXT_INPUT,
key: "rootName",
label: "Root Name"
}
label: "Root Name",
},
];
const defaultSettings = {
namespace: "",
prefix: "I",
rootName: "RootObject"
rootName: "RootObject",
};
export default function() {
export default function () {
const name = "json-to-flow";
const [settings, setSettings] = useSettings(name, defaultSettings);
+1 -1
View File
@@ -2,7 +2,7 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
return JSON.stringify(JSON.parse(value || "{}"), null, 2)
.replace(/\{/gm, "bson.M{")
+1 -1
View File
@@ -4,7 +4,7 @@ import * as React from "react";
import jsonToGo from "json-to-go";
import gofmt from "gofmt.js";
export default function() {
export default function () {
const transformer = useCallback(({ value }) => {
return gofmt(jsonToGo(value).go);
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { jsonToSchema } from "@walmartlabs/json-to-simple-graphql-schema/lib";
export default function() {
export default function () {
const transformer = useCallback(({ value }) => {
return jsonToSchema({ jsonInput: value }).value;
}, []);
+2 -2
View File
@@ -3,10 +3,10 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
const code = transform(value, {
lang: "io-ts"
lang: "io-ts",
});
return `import * as t from "io-ts";\n\n${code}`;
+1 -1
View File
@@ -3,7 +3,7 @@ import * as React from "react";
import { useCallback } from "react";
import { convert } from "@assets/vendor/json-to-jsdoc";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
return convert(value);
}, []);
+2 -2
View File
@@ -2,14 +2,14 @@ import ConversionPanel from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
const { run } = await import("json_typegen_wasm");
return run(
"Root",
value,
JSON.stringify({
output_mode: "json_schema"
output_mode: "json_schema",
})
);
}, []);
+2 -2
View File
@@ -2,14 +2,14 @@ import ConversionPanel from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
const { run } = await import("json_typegen_wasm");
return run(
"Root",
value,
JSON.stringify({
output_mode: "kotlin"
output_mode: "kotlin",
})
);
}, []);
+2 -2
View File
@@ -6,13 +6,13 @@ import { getWorker } from "@utils/workerWrapper";
import { BabelTransforms } from "@constants/babelTransforms";
let babelWorker;
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
babelWorker = babelWorker || getWorker(BabelWorker);
return babelWorker.send({
type: BabelTransforms.JSON_TO_MOBX_TREE,
value
value,
});
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import gs from "generate-schema";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(gs.mongoose(JSON.parse(value)), null, 2);
}, []);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import gs from "generate-schema";
export default function() {
export default function () {
const transformer = useCallback(({ value }) => {
return gs.mysql(JSON.parse(value));
}, []);
+2 -2
View File
@@ -4,12 +4,12 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import { getWorker } from "@utils/workerWrapper";
import { BabelTransforms } from "@constants/babelTransforms";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
const Worker = require("@workers/babel.worker");
return getWorker(Worker).send({
value,
type: BabelTransforms.JSON_TO_PROPTYPES
type: BabelTransforms.JSON_TO_PROPTYPES,
});
}, []);
+8 -8
View File
@@ -18,19 +18,19 @@ const formFields = [
"SCREAMING_SNAKE_CASE",
"kebab-case",
"SCREAMING-KEBAB-CASE",
"UPPERCASE"
].map(value => ({
"UPPERCASE",
].map((value) => ({
label: value,
value
}))
}
value,
})),
},
];
const defaultSettings = {
property_name_format: "camelCase"
property_name_format: "camelCase",
};
export default function() {
export default function () {
const name = "json-to-rust-serde";
const [settings, setSettings] = useSettings(name, defaultSettings);
@@ -43,7 +43,7 @@ export default function() {
value,
JSON.stringify({
output_mode: "rust",
property_name_format: settings.property_name_format
property_name_format: settings.property_name_format,
})
);
},
+2 -2
View File
@@ -3,10 +3,10 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
const code = transform(value, {
lang: "sarcastic"
lang: "sarcastic",
});
return `import is from "sarcastic";\n\n${code}`;
+2 -2
View File
@@ -3,10 +3,10 @@ import ConversionPanel, { Transformer } from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(async ({ value }) => {
return transform(value, {
lang: "scala"
lang: "scala",
});
}, []);
+2 -2
View File
@@ -2,14 +2,14 @@ import ConversionPanel from "@components/ConversionPanel";
import * as React from "react";
import { useCallback } from "react";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
const { run } = await import("json_typegen_wasm");
return run(
"Root",
value,
JSON.stringify({
output_mode: "typescript"
output_mode: "typescript",
})
);
}, []);
+4 -3
View File
@@ -4,9 +4,10 @@ import * as React from "react";
import { stringify } from "yaml";
export default function() {
const transformer = useCallback(({ value }) => {
return stringify(JSON.parse(value));
}, []);
const transformer = useCallback(
({ value }) => Promise.resolve(stringify(JSON.parse(value))),
[]
);
return (
<ConversionPanel
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { compact } from "jsonld";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
const jsonLd = await compact(
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { expand } from "jsonld";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
const jsonLd = await expand(JSON.parse(value));
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { flatten } from "jsonld";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
const jsonLd = await flatten(
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { frame } from "jsonld";
export default function() {
export default function () {
const transformer = useCallback<Transformer>(
async ({ value, splitEditorValue }) => {
const jsonLd = await frame(
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { normalize } from "jsonld";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return normalize(JSON.parse(value));
}, []);
+2 -2
View File
@@ -3,10 +3,10 @@ import { useCallback } from "react";
import * as React from "react";
import { toRDF } from "jsonld";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return (toRDF(JSON.parse(value), {
format: "application/n-quads"
format: "application/n-quads",
}) as unknown) as Promise<string>;
}, []);
+3 -3
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import { markdown } from "markdown";
export default function() {
export default function () {
const transformer = useCallback(({ value }) => {
return markdown.toHTML(value);
}, []);
@@ -16,9 +16,9 @@ export default function() {
resultTitle="HTML"
resultLanguage={"html"}
resultEditorProps={{
previewElement: value => (
previewElement: (value) => (
<div dangerouslySetInnerHTML={{ __html: value }} />
)
),
}}
/>
);
+7 -7
View File
@@ -17,21 +17,21 @@ const formFields = [
{
label: "Transpile css tags",
key: "css",
type: InputType.SWITCH
type: InputType.SWITCH,
},
{
label: "Transpile styled tags",
key: "styled",
type: InputType.SWITCH
}
type: InputType.SWITCH,
},
];
let babelWorker;
export default function() {
export default function () {
const name = "object-styles-to-template-literal";
const [settings, setSettings] = useSettings(name, {
css: true,
styled: true
styled: true,
});
const transformer = useCallback<Transformer>(
@@ -41,7 +41,7 @@ export default function() {
return babelWorker.send({
value,
type: BabelTransforms.OBJECT_STYLES_TO_TEMPLATE,
settings
settings,
});
},
[settings]
@@ -79,7 +79,7 @@ export default function() {
settings.styled ? "" : ",styled"
} tags transpilation. Change it in settings.`}
/>
)
),
}}
settings={settings}
/>
+10 -12
View File
@@ -7,7 +7,7 @@ import { Pane, Heading, Link } from "evergreen-ui";
import {
defaultNativeSettings,
formFields,
nativeRequiredSettings
nativeRequiredSettings,
} from "@constants/svgoConfig";
import isSvg from "is-svg";
import { getWorker } from "@utils/workerWrapper";
@@ -21,7 +21,7 @@ if (IN_BROWSER) {
}
let svgo, _babelWorker, svgr;
export default function() {
export default function () {
const name = "SVG to React Native";
const [value, setValue] = useState("");
const [url, setUrl] = useState("");
@@ -30,13 +30,11 @@ export default function() {
const snackSession = useRef<any>();
useEffect(() => {
(async function() {
(async function () {
snackSession.current = new SnackSession({
files: { "App.js": { contents: "", type: "CODE" } },
sessionId: Math.random()
.toString(36)
.substr(2, 8),
sdkVersion: "37.0.0"
sessionId: Math.random().toString(36).substr(2, 8),
sdkVersion: "37.0.0",
});
snackSession.current.startAsync();
@@ -50,9 +48,9 @@ export default function() {
}, []);
useEffect(() => {
(async function() {
(async function () {
await snackSession.current.sendCodeAsync({
"App.js": { contents: value, type: "CODE" }
"App.js": { contents: value, type: "CODE" },
});
})();
}, [value]);
@@ -68,8 +66,8 @@ export default function() {
value,
settings: {
...(settings.optimizeSvg ? settings : {}),
...nativeRequiredSettings
}
...nativeRequiredSettings,
},
});
// set optimized value in state to be used by preview.
@@ -79,7 +77,7 @@ export default function() {
_value = await svgr.send({
native: true,
value: _value
value: _value,
});
setValue(_value);
+2 -2
View File
@@ -4,7 +4,7 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function() {
export default function () {
const transformer = useCallback(
({ value }) => request("/api/typescript-to-flow", value),
[]
@@ -23,7 +23,7 @@ export default function() {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
)
),
}}
/>
);
+2 -2
View File
@@ -4,7 +4,7 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function() {
export default function () {
const transformer = useCallback(
({ value }) => request("/api/typescript-to-json-schema", value),
[]
@@ -24,7 +24,7 @@ export default function() {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
)
),
}}
/>
);
@@ -4,13 +4,13 @@ import { useCallback } from "react";
import request from "@utils/request";
import { Alert } from "evergreen-ui";
export default function() {
export default function () {
const transformer = useCallback(
({ value }) =>
request("/api/flow-to-typescript", {
value,
declarationOnly: true,
isTS: true
isTS: true,
}),
[]
);
@@ -28,7 +28,7 @@ export default function() {
backgroundColor="#e7f7ff"
title="This code is converted on the server."
/>
)
),
}}
/>
);
+2 -2
View File
@@ -3,12 +3,12 @@ import { useCallback } from "react";
import * as React from "react";
import { xml2json } from "xml-js";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(
JSON.parse(
xml2json(value, {
compact: true
compact: true,
})
)
);
+1 -1
View File
@@ -3,7 +3,7 @@ import { useCallback } from "react";
import * as React from "react";
import yaml from "yaml";
export default function() {
export default function () {
const transformer = useCallback(async ({ value }) => {
return JSON.stringify(yaml.parse(value));
}, []);
+13
View File
@@ -0,0 +1,13 @@
diff --git a/node_modules/relay-compiler/lib/core/GraphQLCompilerProfiler.js b/node_modules/relay-compiler/lib/core/GraphQLCompilerProfiler.js
index 443d7f5..90119ec 100644
--- a/node_modules/relay-compiler/lib/core/GraphQLCompilerProfiler.js
+++ b/node_modules/relay-compiler/lib/core/GraphQLCompilerProfiler.js
@@ -189,6 +189,8 @@ function instrumentWait(fn, name) {
return instrumented;
}
+process.hrtime = () => {}
+
var T_ZERO = process.hrtime(); // Return a Uint32 of microtime duration since program start.
function microtime() {
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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();
+81 -81
View File
@@ -11,30 +11,30 @@ export const categorizedRoutes = [
path: "/",
packageName: "@svgr/core",
packageUrl: "https://github.com/smooth-code/svgr",
title: "Transform | A polyglot web converter."
title: "Transform | A polyglot web converter.",
},
{
label: "to React Native",
path: "/svg-to-react-native",
packageName: "@svgr/core",
packageUrl: "https://github.com/smooth-code/svgr"
}
]
packageUrl: "https://github.com/smooth-code/svgr",
},
],
},
{
category: "HTML",
content: [
{
label: "to JSX",
path: "/html-to-jsx"
path: "/html-to-jsx",
},
{
label: "to Pug",
path: "/html-to-pug",
packageName: "html2pug",
packageUrl: "https://github.com/izolate/html2pug"
}
]
packageUrl: "https://github.com/izolate/html2pug",
},
],
},
{
category: "JSON",
@@ -42,101 +42,101 @@ export const categorizedRoutes = [
{
label: "to React PropTypes",
path: "/json-to-proptypes",
title: "Transform | All important transforms at one place."
title: "Transform | All important transforms at one place.",
},
{
label: "to Flow",
path: "/json-to-flow"
path: "/json-to-flow",
},
{
label: "to GraphQL",
path: "/json-to-graphql",
packageName: "@walmartlabs/json-to-simple-graphql-schema",
packageUrl:
"https://github.com/walmartlabs/json-to-simple-graphql-schema"
"https://github.com/walmartlabs/json-to-simple-graphql-schema",
},
{
label: "to TypeScript",
path: "/json-to-typescript",
packageUrl: "https://www.npmjs.com/package/json_typegen_wasm",
packageName: "json_typegen_wasm"
packageName: "json_typegen_wasm",
},
{
label: "to MobX-State-Tree Model",
path: "/json-to-mobx-state-tree"
path: "/json-to-mobx-state-tree",
},
{
label: "to Sarcastic",
path: "/json-to-sarcastic",
packageName: "transform-json-types",
packageUrl: "https://github.com/transform-it/transform-json-types"
packageUrl: "https://github.com/transform-it/transform-json-types",
},
{
label: "to io-ts",
path: "/json-to-io-ts",
packageName: "transform-json-types",
packageUrl: "https://github.com/transform-it/transform-json-types"
packageUrl: "https://github.com/transform-it/transform-json-types",
},
{
label: "to Rust Serde",
path: "/json-to-rust-serde",
desc: "An online REPL for converting JSON to Rust Serde Structs."
desc: "An online REPL for converting JSON to Rust Serde Structs.",
},
{
label: "to Mongoose Schema",
path: "/json-to-mongoose",
packageName: "generate-schema",
packageUrl: "https://github.com/nijikokun/generate-schema"
packageUrl: "https://github.com/nijikokun/generate-schema",
},
{
label: "to Big Query Schema",
path: "/json-to-big-query",
packageName: "generate-schema",
packageUrl: "https://github.com/nijikokun/generate-schema"
packageUrl: "https://github.com/nijikokun/generate-schema",
},
{
label: "to MySQL",
path: "/json-to-mysql",
packageName: "generate-schema",
packageUrl: "https://github.com/nijikokun/generate-schema"
packageUrl: "https://github.com/nijikokun/generate-schema",
},
{
label: "to Scala Case Class",
path: "/json-to-scala-case-class"
path: "/json-to-scala-case-class",
},
{
label: "to Go Struct",
path: "/json-to-go",
packageName: "json-to-go",
packageUrl: "https://github.com/mholt/json-to-go"
packageUrl: "https://github.com/mholt/json-to-go",
},
{
label: "to Go Bson",
path: "/json-to-go-bson"
path: "/json-to-go-bson",
},
{
label: "to YAML",
path: "/json-to-yaml",
packageName: "json2yaml",
packageUrl: "https://github.com/jeffsu/json2yaml"
packageUrl: "https://github.com/jeffsu/json2yaml",
},
{
label: "to JSDoc",
path: "/json-to-jsdoc"
path: "/json-to-jsdoc",
},
{
label: "to Kotlin",
path: "/json-to-kotlin",
packageUrl: "https://www.npmjs.com/package/json_typegen_wasm",
packageName: "json_typegen_wasm"
packageName: "json_typegen_wasm",
},
{
label: "to JSON Schema",
path: "/json-to-json-schema",
packageUrl: "https://www.npmjs.com/package/json_typegen_wasm",
packageName: "json_typegen_wasm"
}
]
packageName: "json_typegen_wasm",
},
],
},
{
category: "JSON Schema",
@@ -145,15 +145,15 @@ export const categorizedRoutes = [
label: "to TypeScript",
path: "/json-schema-to-typescript",
packageName: "json-schema-to-typescript",
packageUrl: "https://github.com/bcherny/json-schema-to-typescript"
packageUrl: "https://github.com/bcherny/json-schema-to-typescript",
},
{
label: "to OpenAPI Schema",
path: "json-schema-to-openapi-schema",
packageName: "json-schema-to-openapi-schema",
packageUrl: "https://github.com/wework/json-schema-to-openapi-schema"
}
]
packageUrl: "https://github.com/wework/json-schema-to-openapi-schema",
},
],
},
{
category: "CSS",
@@ -162,16 +162,16 @@ export const categorizedRoutes = [
label: "to JS Objects",
path: "/css-to-js",
packageName: "transform-css-to-js",
packageUrl: "https://github.com/transform-it/transform-css-to-js"
packageUrl: "https://github.com/transform-it/transform-css-to-js",
},
{
label: "to template literal",
path: "/object-styles-to-template-literal",
packageUrl:
"https://github.com/satya164/babel-plugin-object-styles-to-template",
packageName: "babel-plugin-object-styles-to-template"
}
]
packageName: "babel-plugin-object-styles-to-template",
},
],
},
{
category: "JavaScript",
@@ -179,89 +179,89 @@ export const categorizedRoutes = [
{
label: "to JSON",
path: "/js-object-to-json",
desc: "An online REPL for converting JS Object to JSON."
}
]
desc: "An online REPL for converting JS Object to JSON.",
},
],
},
{
category: "GraphQL",
content: [
{
label: "to TypeScript",
path: "/graphql-to-typescript"
path: "/graphql-to-typescript",
},
{
label: "to Flow",
path: "/graphql-to-flow"
path: "/graphql-to-flow",
},
{
label: "to JAVA",
path: "/graphql-to-java"
path: "/graphql-to-java",
},
{
label: "to Resolvers Signature",
path: "/graphql-to-resolvers-signature"
path: "/graphql-to-resolvers-signature",
},
{
label: "to Introspection JSON",
path: "/graphql-to-introspection-json"
path: "/graphql-to-introspection-json",
},
{
label: "to Schema AST",
path: "/graphql-to-schema-ast"
path: "/graphql-to-schema-ast",
},
{
label: "to Fragment Matcher",
path: "/graphql-to-fragment-matcher"
path: "/graphql-to-fragment-matcher",
},
{
label: "to Components",
path: "/graphql-to-components"
path: "/graphql-to-components",
},
{
label: "to TypeScript MongoDB",
path: "/graphql-to-typescript-mongodb"
}
].map(x => ({
path: "/graphql-to-typescript-mongodb",
},
].map((x) => ({
...x,
packageUrl: "https://github.com/dotansimha/graphql-code-generator",
packageName: "graphql-code-generator"
}))
packageName: "graphql-code-generator",
})),
},
{
category: "JSON-LD",
content: [
{
label: "to N-Quads",
path: "/jsonld-to-nquads"
path: "/jsonld-to-nquads",
},
{
label: "to Expanded",
path: "/jsonld-to-expanded"
path: "/jsonld-to-expanded",
},
{
label: "to Compacted",
path: "/jsonld-to-compacted"
path: "/jsonld-to-compacted",
},
{
label: "to Flattened",
path: "/jsonld-to-flattened"
path: "/jsonld-to-flattened",
},
{
label: "to Framed",
path: "/jsonld-to-framed"
path: "/jsonld-to-framed",
},
{
label: "to Normalized",
path: "jsonld-to-normalized"
}
].map(x => ({
path: "jsonld-to-normalized",
},
].map((x) => ({
...x,
packageName: "jsonld",
packageUrl: "https://github.com/digitalbazaar/jsonld.js"
}))
packageUrl: "https://github.com/digitalbazaar/jsonld.js",
})),
},
{
category: "TypeScript",
@@ -270,19 +270,19 @@ export const categorizedRoutes = [
label: "to Flow",
path: "/typescript-to-flow",
packageName: "flowgen",
packageUrl: "https://github.com/joarwilk/flowgen"
packageUrl: "https://github.com/joarwilk/flowgen",
},
{
label: "to TypeScript Declaration",
path: "/typescript-to-typescript-declaration"
path: "/typescript-to-typescript-declaration",
},
{
label: "to JSON Schema",
path: "/typescript-to-json-schema",
packageName: "ts-json-schema-generator",
packageUrl: "https://github.com/vega/ts-json-schema-generator"
}
]
packageUrl: "https://github.com/vega/ts-json-schema-generator",
},
],
},
{
category: "Flow",
@@ -290,13 +290,13 @@ export const categorizedRoutes = [
content: [
{
label: "to TypeScript",
path: "/flow-to-typescript"
path: "/flow-to-typescript",
},
{
label: "to TypeScript Declaration",
path: "/flow-to-typescript-declaration"
}
]
path: "/flow-to-typescript-declaration",
},
],
},
{
category: "Others",
@@ -306,23 +306,23 @@ export const categorizedRoutes = [
label: "XML to JSON",
path: "/xml-to-json",
packageName: "xml-js",
packageUrl: "https://github.com/nashwaan/xml-js"
packageUrl: "https://github.com/nashwaan/xml-js",
},
{
label: "YAML to JSON",
path: "/yaml-to-json",
packageName: "yaml",
packageUrl: "https://github.com/tj/js-yaml"
packageUrl: "https://github.com/tj/js-yaml",
},
{
label: "Markdown to HTML",
path: "/markdown-to-html",
packageName: "markdown",
packageUrl: "https://github.com/evilstreak/markdown-js"
}
]
}
packageUrl: "https://github.com/evilstreak/markdown-js",
},
],
},
];
export interface Route {
@@ -332,9 +332,9 @@ export interface Route {
}
export const routes = flatten(
categorizedRoutes.map(a =>
categorizedRoutes.map((a) =>
// @ts-ignore
a.content.map(x => {
a.content.map((x) => {
const _label =
a.category.toLowerCase() !== "others"
? `${a.category} ${x.label}`
@@ -343,12 +343,12 @@ export const routes = flatten(
...x,
category: a.category,
searchTerm: _label,
desc: x.desc || `An online Repl to convert ${_label}`
desc: x.desc || `An online Repl to convert ${_label}`,
};
})
)
);
export function activeRouteData(pathname) {
return find(routes, o => o.path === pathname);
return find(routes, (o) => o.path === pathname);
}
+65 -65
View File
@@ -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",
},
};
+2 -2
View File
@@ -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;
+7 -7
View File
@@ -25,14 +25,14 @@ async function handleJsonToProptypes(value, id) {
}
const result = transform(`const propTypes = ${JSON.stringify(code)}`, {
plugins: [jsonToProptypes]
plugins: [jsonToProptypes],
}).code;
const prettyCode = await prettify("javascript", result);
_self.postMessage({
id,
payload: prettyCode
payload: prettyCode,
});
}
@@ -40,8 +40,8 @@ function objectStylesToTemplate(value, id, settings) {
_self.postMessage({
id,
payload: transform(value, {
plugins: [[objStylesToTemplate, settings]]
}).code
plugins: [[objStylesToTemplate, settings]],
}).code,
});
}
@@ -49,8 +49,8 @@ function jsonToMobx(value, id) {
_self.postMessage({
id,
payload: transform(`const myModel = ${value}`, {
plugins: [jsonToMobxTree]
}).code
plugins: [jsonToMobxTree],
}).code,
});
}
@@ -71,7 +71,7 @@ _self.onmessage = ({ data: { id, payload } }: { data: Data }) => {
}
_self.postMessage({
id,
err: e.message
err: e.message,
});
}
};
+2 -2
View File
@@ -75,8 +75,8 @@ _self.onmessage = async ({ data: { id, payload } }) => {
documents: document.trim()
? [
{
filePath: "",
content: parse(document)
location: "",
document: parse(document)
}
]
: [],
+2 -2
View File
@@ -9,12 +9,12 @@ _self.onmessage = ({ data: { payload, id } }) => {
_self.postMessage({
id,
payload: JSON.stringify(postcssJs.objectify(root))
payload: JSON.stringify(postcssJs.objectify(root)),
});
} catch (e) {
_self.postMessage({
id,
err: e.message
err: e.message,
});
}
};
+5 -5
View File
@@ -16,21 +16,21 @@ const _self = self as any;
_self.onmessage = ({
data: {
payload: { value, language },
id
}
id,
},
}: Data) => {
(async function() {
(async function () {
try {
const payload = await prettify(language, value);
_self.postMessage({
id,
payload
payload,
});
} catch (e) {
_self.postMessage({
id,
err: e.message
err: e.message,
});
}
})();
+5 -5
View File
@@ -16,20 +16,20 @@ _self.onmessage = ({ data: { id, payload } }: { data: Data }) => {
delete payload.settings.optimizeSvg;
const plugins = Object.keys(payload.settings).filter(
key => payload.settings[key]
(key) => payload.settings[key]
);
try {
const svgo = new SVGO({
full: true,
// @ts-ignore
plugins
plugins,
});
svgo.optimize(payload.value).then(result => {
svgo.optimize(payload.value).then((result) => {
_self.postMessage({
id,
payload: result.data
payload: result.data,
});
});
} catch (e) {
@@ -38,7 +38,7 @@ _self.onmessage = ({ data: { id, payload } }: { data: Data }) => {
}
_self.postMessage({
id,
err: e.message
err: e.message,
});
}
};
+3 -3
View File
@@ -9,17 +9,17 @@ _self.onmessage = async ({ data: { payload, id } }) => {
const result = await convert(value, {
plugins: [require("@svgr/plugin-jsx").default],
svgo: false,
native
native,
});
_self.postMessage({
payload: result,
id
id,
});
} catch (e) {
_self.postMessage({
id,
error: e.message
error: e.message,
});
}
};
+2983 -2885
View File
File diff suppressed because it is too large. Load diff