diff --git a/package-lock.json b/package-lock.json index 200a070f..8183d79d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "@eslint/compat": "^1.3.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.29.0", - "@tauri-apps/cli": "^2.8.4", + "@tauri-apps/cli": "^2.9.1", "@typescript-eslint/eslint-plugin": "^8.27.0", "@typescript-eslint/parser": "^8.27.0", "@yaakapp/cli": "^0.2.7", @@ -3112,9 +3112,9 @@ } }, "node_modules/@tauri-apps/api": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.8.0.tgz", - "integrity": "sha512-ga7zdhbS2GXOMTIZRT0mYjKJtR9fivsXzsyq5U3vjDL0s6DTMwYRm0UHNjzTY5dh4+LSC68Sm/7WEiimbQNYlw==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.9.0.tgz", + "integrity": "sha512-qD5tMjh7utwBk9/5PrTA/aGr3i5QaJ/Mlt7p8NilQ45WgbifUNPyKWsA63iQ8YfQq6R8ajMapU+/Q8nMcPRLNw==", "license": "Apache-2.0 OR MIT", "funding": { "type": "opencollective", @@ -3122,9 +3122,9 @@ } }, "node_modules/@tauri-apps/cli": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.8.4.tgz", - "integrity": "sha512-ejUZBzuQRcjFV+v/gdj/DcbyX/6T4unZQjMSBZwLzP/CymEjKcc2+Fc8xTORThebHDUvqoXMdsCZt8r+hyN15g==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.9.1.tgz", + "integrity": "sha512-kKi2/WWsNXKoMdatBl4xrT7e1Ce27JvsetBVfWuIb6D3ep/Y0WO5SIr70yarXOSWam8NyDur4ipzjZkg6m7VDg==", "dev": true, "license": "Apache-2.0 OR MIT", "bin": { @@ -3138,23 +3138,23 @@ "url": "https://opencollective.com/tauri" }, "optionalDependencies": { - "@tauri-apps/cli-darwin-arm64": "2.8.4", - "@tauri-apps/cli-darwin-x64": "2.8.4", - "@tauri-apps/cli-linux-arm-gnueabihf": "2.8.4", - "@tauri-apps/cli-linux-arm64-gnu": "2.8.4", - "@tauri-apps/cli-linux-arm64-musl": "2.8.4", - "@tauri-apps/cli-linux-riscv64-gnu": "2.8.4", - "@tauri-apps/cli-linux-x64-gnu": "2.8.4", - "@tauri-apps/cli-linux-x64-musl": "2.8.4", - "@tauri-apps/cli-win32-arm64-msvc": "2.8.4", - "@tauri-apps/cli-win32-ia32-msvc": "2.8.4", - "@tauri-apps/cli-win32-x64-msvc": "2.8.4" + "@tauri-apps/cli-darwin-arm64": "2.9.1", + "@tauri-apps/cli-darwin-x64": "2.9.1", + "@tauri-apps/cli-linux-arm-gnueabihf": "2.9.1", + "@tauri-apps/cli-linux-arm64-gnu": "2.9.1", + "@tauri-apps/cli-linux-arm64-musl": "2.9.1", + "@tauri-apps/cli-linux-riscv64-gnu": "2.9.1", + "@tauri-apps/cli-linux-x64-gnu": "2.9.1", + "@tauri-apps/cli-linux-x64-musl": "2.9.1", + "@tauri-apps/cli-win32-arm64-msvc": "2.9.1", + "@tauri-apps/cli-win32-ia32-msvc": "2.9.1", + "@tauri-apps/cli-win32-x64-msvc": "2.9.1" } }, "node_modules/@tauri-apps/cli-darwin-arm64": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.8.4.tgz", - "integrity": "sha512-BKu8HRkYV01SMTa7r4fLx+wjgtRK8Vep7lmBdHDioP6b8XH3q2KgsAyPWfEZaZIkZ2LY4SqqGARaE9oilNe0oA==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.9.1.tgz", + "integrity": "sha512-sdwhtsE/6njD0AjgfYEj1JyxZH4SBmCJSXpRm6Ph5fQeuZD6MyjzjdVOrrtFguyREVQ7xn0Ujkwvbo01ULthNg==", "cpu": [ "arm64" ], @@ -3169,9 +3169,9 @@ } }, "node_modules/@tauri-apps/cli-darwin-x64": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.8.4.tgz", - "integrity": "sha512-imb9PfSd/7G6VAO7v1bQ2A3ZH4NOCbhGJFLchxzepGcXf9NKkfun157JH9mko29K6sqAwuJ88qtzbKCbWJTH9g==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.9.1.tgz", + "integrity": "sha512-c86g+67wTdI4TUCD7CaSd/13+oYuLQxVST4ZNJ5C+6i1kdnU3Us1L68N9MvbDLDQGJc9eo0pvuK6sCWkee+BzA==", "cpu": [ "x64" ], @@ -3186,9 +3186,9 @@ } }, "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.8.4.tgz", - "integrity": "sha512-Ml215UnDdl7/fpOrF1CNovym/KjtUbCuPgrcZ4IhqUCnhZdXuphud/JT3E8X97Y03TZ40Sjz8raXYI2ET0exzw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.9.1.tgz", + "integrity": "sha512-IrB3gFQmueQKJjjisOcMktW/Gh6gxgqYO419doA3YZ7yIV5rbE8ZW52Q3I4AO+SlFEyVYer5kpi066p0JBlLGw==", "cpu": [ "arm" ], @@ -3203,9 +3203,9 @@ } }, "node_modules/@tauri-apps/cli-linux-arm64-gnu": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.8.4.tgz", - "integrity": "sha512-pbcgBpMyI90C83CxE5REZ9ODyIlmmAPkkJXtV398X3SgZEIYy5TACYqlyyv2z5yKgD8F8WH4/2fek7+jH+ZXAw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.9.1.tgz", + "integrity": "sha512-Ke7TyXvu6HbWSkmVkFbbH19D3cLsd117YtXP/u9NIvSpYwKeFtnbpirrIUfPm44Q+PZFZ2Hvg8X9qoUiAK0zKw==", "cpu": [ "arm64" ], @@ -3220,9 +3220,9 @@ } }, "node_modules/@tauri-apps/cli-linux-arm64-musl": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.8.4.tgz", - "integrity": "sha512-zumFeaU1Ws5Ay872FTyIm7z8kfzEHu8NcIn8M6TxbJs0a7GRV21KBdpW1zNj2qy7HynnpQCqjAYXTUUmm9JAOw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.9.1.tgz", + "integrity": "sha512-sGvy75sv55oeMulR5ArwPD28DsDQxqTzLhXCrpU9/nbFg/JImmI7k994YE9fr3V0qE3Cjk5gjLldRNv7I9sjwQ==", "cpu": [ "arm64" ], @@ -3237,9 +3237,9 @@ } }, "node_modules/@tauri-apps/cli-linux-riscv64-gnu": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.8.4.tgz", - "integrity": "sha512-qiqbB3Zz6IyO201f+1ojxLj65WYj8mixL5cOMo63nlg8CIzsP23cPYUrx1YaDPsCLszKZo7tVs14pc7BWf+/aQ==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.9.1.tgz", + "integrity": "sha512-tEKbJydV3BdIxpAx8aGHW6VDg1xW4LlQuRD/QeFZdZNTreHJpMbJEcdvAcI+Hg6vgQpVpaoEldR9W4F6dYSLqQ==", "cpu": [ "riscv64" ], @@ -3254,9 +3254,9 @@ } }, "node_modules/@tauri-apps/cli-linux-x64-gnu": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.8.4.tgz", - "integrity": "sha512-TaqaDd9Oy6k45Hotx3pOf+pkbsxLaApv4rGd9mLuRM1k6YS/aw81YrsMryYPThrxrScEIUcmNIHaHsLiU4GMkw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.9.1.tgz", + "integrity": "sha512-mg5msXHagtHpyCVWgI01M26JeSrgE/otWyGdYcuTwyRYZYEJRTbcNt7hscOkdNlPBe7isScW7PVKbxmAjJJl4g==", "cpu": [ "x64" ], @@ -3271,9 +3271,9 @@ } }, "node_modules/@tauri-apps/cli-linux-x64-musl": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.8.4.tgz", - "integrity": "sha512-ot9STAwyezN8w+bBHZ+bqSQIJ0qPZFlz/AyscpGqB/JnJQVDFQcRDmUPFEaAtt2UUHSWzN3GoTJ5ypqLBp2WQA==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.9.1.tgz", + "integrity": "sha512-lFZEXkpDreUe3zKilvnMsrnKP9gwQudaEjDnOz/GMzbzNceIuPfFZz0cR/ky1Aoq4eSvZonPKHhROq4owz4fzg==", "cpu": [ "x64" ], @@ -3288,9 +3288,9 @@ } }, "node_modules/@tauri-apps/cli-win32-arm64-msvc": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.8.4.tgz", - "integrity": "sha512-+2aJ/g90dhLiOLFSD1PbElXX3SoMdpO7HFPAZB+xot3CWlAZD1tReUFy7xe0L5GAR16ZmrxpIDM9v9gn5xRy/w==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.9.1.tgz", + "integrity": "sha512-ejc5RAp/Lm1Aj0EQHaT+Wdt5PHfdgQV5hIDV00MV6HNbIb5W4ZUFxMDaRkAg65gl9MvY2fH396riePW3RoKXDw==", "cpu": [ "arm64" ], @@ -3305,9 +3305,9 @@ } }, "node_modules/@tauri-apps/cli-win32-ia32-msvc": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.8.4.tgz", - "integrity": "sha512-yj7WDxkL1t9Uzr2gufQ1Hl7hrHuFKTNEOyascbc109EoiAqCp0tgZ2IykQqOZmZOHU884UAWI1pVMqBhS/BfhA==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.9.1.tgz", + "integrity": "sha512-fSATtJDc0fNjVB6ystyi8NbwhNFk8i8E05h6KrsC8Fio5eaJIJvPCbC9pdrPl6kkxN1X7fj25ErBbgfqgcK8Fg==", "cpu": [ "ia32" ], @@ -3322,9 +3322,9 @@ } }, "node_modules/@tauri-apps/cli-win32-x64-msvc": { - "version": "2.8.4", - "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.8.4.tgz", - "integrity": "sha512-XuvGB4ehBdd7QhMZ9qbj/8icGEatDuBNxyYHbLKsTYh90ggUlPa/AtaqcC1Fo69lGkTmq9BOKrs1aWSi7xDonA==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.9.1.tgz", + "integrity": "sha512-/JHlOzpUDhjBOO9w167bcYxfJbcMQv7ykS/Y07xjtcga8np0rzUzVGWYmLMH7orKcDMC7wjhheEW1x8cbGma/Q==", "cpu": [ "x64" ], @@ -18525,26 +18525,11 @@ } } }, - "node_modules/xml-formatter": { - "version": "3.6.6", - "resolved": "https://registry.npmjs.org/xml-formatter/-/xml-formatter-3.6.6.tgz", - "integrity": "sha512-yfofQht42x2sN1YThT6Er6GFXiQinfDAsMTNvMPi2uZw5/Vtc2PYHfvALR8U+b2oN2ekBxLd2tGWV06rAM8nQA==", - "license": "MIT", - "dependencies": { - "xml-parser-xo": "^4.1.4" - }, - "engines": { - "node": ">= 16" - } - }, - "node_modules/xml-parser-xo": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/xml-parser-xo/-/xml-parser-xo-4.1.4.tgz", - "integrity": "sha512-wo+yWDNeMwd1ctzH4CsiGXaAappDsxuR+VnmPewOzHk/zvefksT2ZlcWpAePl11THOWgnIZM4GjvumevurNWZw==", - "license": "MIT", - "engines": { - "node": ">= 16" - } + "node_modules/xml-beautify": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/xml-beautify/-/xml-beautify-1.2.3.tgz", + "integrity": "sha512-VsYpkqoVawIP84pi00XukPsgQHqOhgrpwTHlXqqRMAgYZ1u+Yw3KHIUhO1Igf19d5CQ5h6ExJT1hFCJRLmzADg==", + "license": "MIT" }, "node_modules/xpath": { "version": "0.0.34", @@ -19064,7 +19049,7 @@ "@tanstack/react-query": "^5.90.5", "@tanstack/react-router": "^1.133.13", "@tanstack/react-virtual": "^3.13.12", - "@tauri-apps/api": "^2.8.0", + "@tauri-apps/api": "^2.9.0", "@tauri-apps/plugin-clipboard-manager": "^2.3.0", "@tauri-apps/plugin-dialog": "^2.4.0", "@tauri-apps/plugin-fs": "^2.4.2", @@ -19104,7 +19089,7 @@ "slugify": "^1.6.6", "uuid": "^11.1.0", "whatwg-mimetype": "^4.0.0", - "xml-formatter": "^3.6.3", + "xml-beautify": "^1.2.3", "yaml": "^2.6.1" }, "devDependencies": { diff --git a/package.json b/package.json index b59044ac..8d2f367c 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "@eslint/compat": "^1.3.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.29.0", - "@tauri-apps/cli": "^2.8.4", + "@tauri-apps/cli": "^2.9.1", "@typescript-eslint/eslint-plugin": "^8.27.0", "@typescript-eslint/parser": "^8.27.0", "@yaakapp/cli": "^0.2.7", diff --git a/src-web/lib/formatters.ts b/src-web/lib/formatters.ts index 214a5396..9a97339a 100644 --- a/src-web/lib/formatters.ts +++ b/src-web/lib/formatters.ts @@ -1,8 +1,12 @@ -import xmlFormat from 'xml-formatter'; +import XmlBeautify from 'xml-beautify'; import { invokeCmd } from './tauri'; const INDENT = ' '; +const xmlBeautifier = new XmlBeautify({ + INDENT, +}); + export async function tryFormatJson(text: string): Promise { if (text === '') return text; @@ -16,9 +20,8 @@ export async function tryFormatJson(text: string): Promise { try { return JSON.stringify(JSON.parse(text), null, 2); - // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (err) { - // Nothing + console.log("JSON beautify failed", err); } return text; @@ -28,9 +31,9 @@ export async function tryFormatXml(text: string): Promise { if (text === '') return text; try { - return xmlFormat(text, { throwOnFailure: true, strictMode: false, indentation: INDENT }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars + return xmlBeautifier.beautify(text); } catch (err) { + console.log("XML beautify failed", err); return text; } } diff --git a/src-web/modules.d.ts b/src-web/modules.d.ts index 7c54b413..419a39e5 100644 --- a/src-web/modules.d.ts +++ b/src-web/modules.d.ts @@ -1 +1,2 @@ declare module 'format-graphql'; +declare module 'xml-beautify'; diff --git a/src-web/package.json b/src-web/package.json index ce239f9b..0b231632 100644 --- a/src-web/package.json +++ b/src-web/package.json @@ -26,7 +26,7 @@ "@tanstack/react-query": "^5.90.5", "@tanstack/react-router": "^1.133.13", "@tanstack/react-virtual": "^3.13.12", - "@tauri-apps/api": "^2.8.0", + "@tauri-apps/api": "^2.9.0", "@tauri-apps/plugin-clipboard-manager": "^2.3.0", "@tauri-apps/plugin-dialog": "^2.4.0", "@tauri-apps/plugin-fs": "^2.4.2", @@ -66,7 +66,7 @@ "slugify": "^1.6.6", "uuid": "^11.1.0", "whatwg-mimetype": "^4.0.0", - "xml-formatter": "^3.6.3", + "xml-beautify": "^1.2.3", "yaml": "^2.6.1" }, "devDependencies": {