{"id":15428397,"url":"https://github.com/egust/jq-web-wasm","last_synced_at":"2025-11-07T21:30:38.130Z","repository":{"id":78301791,"uuid":"594697098","full_name":"eGust/jq-web-wasm","owner":"eGust","description":"Repack `jq-web` for Node v18+ with TypeScript support","archived":false,"fork":false,"pushed_at":"2023-01-29T11:49:47.000Z","size":291,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T00:21:36.706Z","etag":null,"topics":["jq","jq-web","wasm"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eGust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-29T11:12:55.000Z","updated_at":"2023-05-29T04:28:45.000Z","dependencies_parsed_at":"2023-07-24T14:03:01.497Z","dependency_job_id":null,"html_url":"https://github.com/eGust/jq-web-wasm","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"3dd65c102e2293e3885100b3cb29643adb192406"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eGust%2Fjq-web-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eGust%2Fjq-web-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eGust%2Fjq-web-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eGust%2Fjq-web-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eGust","download_url":"https://codeload.github.com/eGust/jq-web-wasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239540072,"owners_count":19655934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jq","jq-web","wasm"],"created_at":"2024-10-01T18:04:29.510Z","updated_at":"2025-11-07T21:30:38.095Z","avatar_url":"https://github.com/eGust.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# jq-web-wasm\n\nThis is a fork of [jq-web](https://www.npmjs.com/package/jq-web) to support Node v18+ and TypeScript.\n\n## Usage\n\n1. Install\n\n    ```bash\n    npm i jq-web-wasm\n    # or from Github\n    npm i github:eGust/jq-web-wasm\n    # or\n    yarn add jq-web-wasm\n    # or\n    pnpm i jq-web-wasm\n    ```\n\n2. Use with TypeScript\n\n    ```ts\n    // demo.ts\n    import { assert } from 'node:console';\n    import { promised } from 'jq-web-wasm/jq.wasm';\n\n    const demo = async () =\u003e {\n      const foo = await promised.json({ foo: 'bar' }, '.foo');\n      const baz = JSON.parse(await promised.raw(JSON.stringify({ baz: 'bar' }), '.baz'));\n      console.debug({ foo, baz });\n      assert(foo === 'bar', `foo is not \"bar\" (got ${foo})`);\n      assert(baz === 'bar', `baz is not \"bar\" (got ${baz})`);\n    };\n\n    demo();\n    ```\n\n    ```bash\n    # run it in shell\n    ❯ tsx demo.ts # [tsx](https://www.npmjs.com/package/tsx)\n    { foo: 'bar', baz: 'bar' }\n    ```\n\n## Motivation\n\nDue to Node v18 introduced `fetch` API, the original [jq-web](https://github.com/fiatjaf/jq-web) uses `fetch` to detect whether it's running in a browser env. Unfortunately, this way no longer works since Node v18.\n\nThis package simply replaced `typeof fetch === \"function\"` with `(typeof global !== 'object' \u0026\u0026 typeof fetch === \"function\")` to get it work. In theory it should work for any version that support WASM. However, Node v14 is almost reaches its [EOL](https://endoflife.date/nodejs), so I put the engine to require Node \u003e= 16.\n\n## Compile by yourself\n\nPlease check `scripts` in `package.json`:\n\n1. run `pnpm i` to install dependencies.\n2. run `pnpm copy-wasm-to-dist` to copy `jq.wasm.wasm` to `dist/`.\n3. run `pnpm reformat:jq.wasm.js` to generate readable `dist/reformatted-jq.wasm.js`.\n4. update `dist/reformatted-jq.wasm.js` and replace `dist/jq.wasm.js` with it.\n5. run `pnpm minify` to create `dist/jq.wasm.min.js`\n\n\u003e Sure you can use `npm` or `yarn` instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegust%2Fjq-web-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegust%2Fjq-web-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegust%2Fjq-web-wasm/lists"}