From f5178f1da54512c47364ffeb5a5694d39f582a9a Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Wed, 16 Mar 2022 15:51:26 -0400 Subject: [PATCH 1/5] updates zprint-clj --- packages/insomnia-app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/insomnia-app/package.json b/packages/insomnia-app/package.json index 5d53fb0a85e..c91c6e830b0 100644 --- a/packages/insomnia-app/package.json +++ b/packages/insomnia-app/package.json @@ -174,7 +174,7 @@ "whatwg-fetch": "^2.0.1", "yaml": "^1.5.0", "yaml-source-map": "^2.1.1", - "zprint-clj": "0.2.0" + "zprint-clj": "0.8.0" }, "devDependencies": { "@babel/preset-env": "^7.15.8", From b1f294323b139f80d40b3e1f9fc927ad04340992 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Wed, 16 Mar 2022 15:51:33 -0400 Subject: [PATCH 2/5] package lock --- packages/insomnia-app/package-lock.json | 49 ++++++++++++++++++++----- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/packages/insomnia-app/package-lock.json b/packages/insomnia-app/package-lock.json index 7a513439020..3cac44c7896 100644 --- a/packages/insomnia-app/package-lock.json +++ b/packages/insomnia-app/package-lock.json @@ -80,7 +80,7 @@ "whatwg-fetch": "^2.0.1", "yaml": "^1.5.0", "yaml-source-map": "^2.1.1", - "zprint-clj": "0.2.0" + "zprint-clj": "0.8.0" }, "devDependencies": { "@babel/preset-env": "^7.15.8", @@ -32324,15 +32324,31 @@ } }, "node_modules/zprint-clj": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/zprint-clj/-/zprint-clj-0.2.0.tgz", - "integrity": "sha512-Xq2Q2s8lpDg3be/jShseQtaFg+yDpDq5XrbmdYQ9gL2GxtmJ9mwnLlK7Y8GjgdbyJ+Q1Ui9gNKZ9mdd2lwOXhQ==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/zprint-clj/-/zprint-clj-0.8.0.tgz", + "integrity": "sha512-9Z9p5d6UK/rnrvX/pZ0UM3H9octsdAy+UaGr6hMSK3KXtPFFD3PIrTJ6cNXYvsWiAeFmitcYK/AQQVw/vTf1NQ==", "dependencies": { - "commander": "^2.13.0" + "commander": "^2.13.0", + "fast-glob": "3.1.0" }, "bin": { "zprint-clj": "js-src/cli.js" } + }, + "node_modules/zprint-clj/node_modules/fast-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.0.tgz", + "integrity": "sha512-TrUz3THiq2Vy3bjfQUB2wNyPdGBeGmdjbzzBLhfHN4YFurYptCKwGq/TfiRavbGywFRzY6U2CdmQ1zmsY5yYaw==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=8" + } } }, "dependencies": { @@ -58143,11 +58159,26 @@ } }, "zprint-clj": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/zprint-clj/-/zprint-clj-0.2.0.tgz", - "integrity": "sha512-Xq2Q2s8lpDg3be/jShseQtaFg+yDpDq5XrbmdYQ9gL2GxtmJ9mwnLlK7Y8GjgdbyJ+Q1Ui9gNKZ9mdd2lwOXhQ==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/zprint-clj/-/zprint-clj-0.8.0.tgz", + "integrity": "sha512-9Z9p5d6UK/rnrvX/pZ0UM3H9octsdAy+UaGr6hMSK3KXtPFFD3PIrTJ6cNXYvsWiAeFmitcYK/AQQVw/vTf1NQ==", "requires": { - "commander": "^2.13.0" + "commander": "^2.13.0", + "fast-glob": "3.1.0" + }, + "dependencies": { + "fast-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.0.tgz", + "integrity": "sha512-TrUz3THiq2Vy3bjfQUB2wNyPdGBeGmdjbzzBLhfHN4YFurYptCKwGq/TfiRavbGywFRzY6U2CdmQ1zmsY5yYaw==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2" + } + } } } } From 3840b2071ee10f1de58161f379c6efcbfa57a1ec Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Thu, 17 Mar 2022 09:15:40 -0400 Subject: [PATCH 3/5] removes zprint beautify --- .../app/ui/components/codemirror/code-editor.tsx | 15 +-------------- packages/insomnia-app/package.json | 6 ++---- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx b/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx index fe2e60084c6..aa3b551a755 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx +++ b/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx @@ -14,7 +14,6 @@ import React, { Component, CSSProperties, forwardRef, ForwardRefRenderFunction, import { useSelector } from 'react-redux'; import { unreachable } from 'ts-assert-unreachable'; import vkBeautify from 'vkbeautify'; -import zprint from 'zprint-clj'; import { AUTOBIND_CFG, @@ -725,14 +724,6 @@ export class UnconnectedCodeEditor extends Component { } } - static _prettifyEDN(code: string) { - try { - return zprint(code, null); - } catch (e) { - return code; - } - } - _prettifyXML(code: string) { if (this.props.updateFilter && this.state.filter) { try { @@ -1143,8 +1134,6 @@ export class UnconnectedCodeEditor extends Component { if (shouldPrettify && this._canPrettify()) { if (UnconnectedCodeEditor._isXML(mode)) { code = this._prettifyXML(code); - } else if (UnconnectedCodeEditor._isEDN(mode)) { - code = UnconnectedCodeEditor._prettifyEDN(code); } else if (UnconnectedCodeEditor._isJSON(mode)) { code = this._prettifyJSON(code); } else { @@ -1190,7 +1179,7 @@ export class UnconnectedCodeEditor extends Component { _canPrettify() { const { mode } = this.props; - return UnconnectedCodeEditor._isJSON(mode) || UnconnectedCodeEditor._isXML(mode) || UnconnectedCodeEditor._isEDN(mode); + return UnconnectedCodeEditor._isJSON(mode) || UnconnectedCodeEditor._isXML(mode); } _showFilterHelp() { @@ -1266,8 +1255,6 @@ export class UnconnectedCodeEditor extends Component { contentTypeName = 'JSON'; } else if (UnconnectedCodeEditor._isXML(mode)) { contentTypeName = 'XML'; - } else if (UnconnectedCodeEditor._isEDN(mode)) { - contentTypeName = 'EDN'; } toolbarChildren.push( diff --git a/packages/insomnia-app/package.json b/packages/insomnia-app/package.json index c91c6e830b0..79a097f08db 100644 --- a/packages/insomnia-app/package.json +++ b/packages/insomnia-app/package.json @@ -74,8 +74,7 @@ "srp-js", "styled-components", "swagger-ui-react", - "vkbeautify", - "zprint-clj" + "vkbeautify" ], "dependencies": { "@getinsomnia/node-libcurl": "2.3.4-3", @@ -173,8 +172,7 @@ "vkbeautify": "^0.99.1", "whatwg-fetch": "^2.0.1", "yaml": "^1.5.0", - "yaml-source-map": "^2.1.1", - "zprint-clj": "0.8.0" + "yaml-source-map": "^2.1.1" }, "devDependencies": { "@babel/preset-env": "^7.15.8", From 3a523ebb46fe8aec581ad04e2782178a208a71e7 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Thu, 17 Mar 2022 09:15:48 -0400 Subject: [PATCH 4/5] package lock --- packages/insomnia-app/package-lock.json | 53 +------------------------ 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/packages/insomnia-app/package-lock.json b/packages/insomnia-app/package-lock.json index 3cac44c7896..4b72ec1250a 100644 --- a/packages/insomnia-app/package-lock.json +++ b/packages/insomnia-app/package-lock.json @@ -79,8 +79,7 @@ "vkbeautify": "^0.99.1", "whatwg-fetch": "^2.0.1", "yaml": "^1.5.0", - "yaml-source-map": "^2.1.1", - "zprint-clj": "0.8.0" + "yaml-source-map": "^2.1.1" }, "devDependencies": { "@babel/preset-env": "^7.15.8", @@ -32322,33 +32321,6 @@ "dependencies": { "safe-buffer": "~5.2.0" } - }, - "node_modules/zprint-clj": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/zprint-clj/-/zprint-clj-0.8.0.tgz", - "integrity": "sha512-9Z9p5d6UK/rnrvX/pZ0UM3H9octsdAy+UaGr6hMSK3KXtPFFD3PIrTJ6cNXYvsWiAeFmitcYK/AQQVw/vTf1NQ==", - "dependencies": { - "commander": "^2.13.0", - "fast-glob": "3.1.0" - }, - "bin": { - "zprint-clj": "js-src/cli.js" - } - }, - "node_modules/zprint-clj/node_modules/fast-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.0.tgz", - "integrity": "sha512-TrUz3THiq2Vy3bjfQUB2wNyPdGBeGmdjbzzBLhfHN4YFurYptCKwGq/TfiRavbGywFRzY6U2CdmQ1zmsY5yYaw==", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2" - }, - "engines": { - "node": ">=8" - } } }, "dependencies": { @@ -58157,29 +58129,6 @@ } } } - }, - "zprint-clj": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/zprint-clj/-/zprint-clj-0.8.0.tgz", - "integrity": "sha512-9Z9p5d6UK/rnrvX/pZ0UM3H9octsdAy+UaGr6hMSK3KXtPFFD3PIrTJ6cNXYvsWiAeFmitcYK/AQQVw/vTf1NQ==", - "requires": { - "commander": "^2.13.0", - "fast-glob": "3.1.0" - }, - "dependencies": { - "fast-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.0.tgz", - "integrity": "sha512-TrUz3THiq2Vy3bjfQUB2wNyPdGBeGmdjbzzBLhfHN4YFurYptCKwGq/TfiRavbGywFRzY6U2CdmQ1zmsY5yYaw==", - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2" - } - } - } } } } From d5ff7670ff6a9f6bb5e269ba11d8310f64a7dcc8 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Thu, 17 Mar 2022 11:24:56 -0400 Subject: [PATCH 5/5] removes unnecessary isEDN --- .../app/ui/components/codemirror/code-editor.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx b/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx index aa3b551a755..638148554c6 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx +++ b/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx @@ -678,14 +678,6 @@ export class UnconnectedCodeEditor extends Component { return mode.indexOf('xml') !== -1; } - static _isEDN(mode?: string) { - if (!mode) { - return false; - } - - return mode === 'application/edn' || mode.indexOf('clojure') !== -1; - } - _indentChars() { return this.codeMirror?.getOption('indentWithTabs') ? '\t' @@ -956,7 +948,7 @@ export class UnconnectedCodeEditor extends Component { return 'graphql'; } else if (UnconnectedCodeEditor._isJSON(mimeType)) { return 'application/json'; - } else if (UnconnectedCodeEditor._isEDN(mimeType)) { + } else if (mimeType.includes('clojure')) { return 'application/edn'; } else if (UnconnectedCodeEditor._isXML(mimeType)) { return 'application/xml';