From 4126935c9ceebf9faa271e2d31e90417fe51aa73 Mon Sep 17 00:00:00 2001 From: William Floyd Date: Thu, 5 Mar 2026 10:44:52 -0600 Subject: [PATCH] fix: `jq-web` -> `jq-wasm`, includes `jq` verison `1.8.1` --- package-lock.json | 12 ++++++------ package.json | 2 +- src/core/operations/Jq.mjs | 21 ++++++++++----------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 61db7931..ab3f3bbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,7 +52,7 @@ "highlight.js": "^11.11.1", "ieee754": "^1.2.1", "jimp": "^1.6.0", - "jq-web": "^0.6.2", + "jq-wasm": "^1.1.0-jq-1.8.1", "jquery": "3.7.1", "js-sha3": "^0.9.3", "jsesc": "^3.1.0", @@ -12060,11 +12060,11 @@ "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==", "license": "BSD-3-Clause" }, - "node_modules/jq-web": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/jq-web/-/jq-web-0.6.2.tgz", - "integrity": "sha512-+7XvjBYwTx4vP5PYkf6Q6orubO/v+UgMU6By1GritrmShr9QpT3UKa4ANzXWQfhdqtBnQYXsm7ZNbdIHT6tYpQ==", - "license": "ISC" + "node_modules/jq-wasm": { + "version": "1.1.0-jq-1.8.1", + "resolved": "https://registry.npmjs.org/jq-wasm/-/jq-wasm-1.1.0-jq-1.8.1.tgz", + "integrity": "sha512-lWfu34lpDFIygOYcL5TzxhZIApDR9iR5XywcVoyUAZ6jlQrj8HKHOKeCcHgUm2dE9RVdbP3eqNAKGLuj+k4seQ==", + "license": "MIT" }, "node_modules/jquery": { "version": "3.7.1", diff --git a/package.json b/package.json index 1e87c230..1602b1b6 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "highlight.js": "^11.11.1", "ieee754": "^1.2.1", "jimp": "^1.6.0", - "jq-web": "^0.6.2", + "jq-wasm": "^1.1.0-jq-1.8.1", "jquery": "3.7.1", "js-sha3": "^0.9.3", "jsesc": "^3.1.0", diff --git a/src/core/operations/Jq.mjs b/src/core/operations/Jq.mjs index c1e02b34..4584d1a9 100644 --- a/src/core/operations/Jq.mjs +++ b/src/core/operations/Jq.mjs @@ -6,7 +6,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; -import jq from "jq-web"; +import * as jq from "jq-wasm"; /** * jq operation @@ -40,16 +40,15 @@ class Jq extends Operation { * @returns {string} */ run(input, args) { - const [query] = args; - let result; - - try { - result = jq.json(input, query); - } catch (err) { - throw new OperationError(`Invalid jq expression: ${err.message}`); - } - - return JSON.stringify(result); + return (async () => { + const [query] = args; + try { + const result = await jq.json(input, query); + return JSON.stringify(result); + } catch (err) { + throw new OperationError(`Invalid jq expression: ${err.message}`); + } + })(); } }