Chore: replace ezspawn w/ tinyexec

This commit is contained in:
SukkaW 2024-11-13 21:20:20 +08:00
parent 6bc65c4088
commit d703bef4b0
3 changed files with 11 additions and 34 deletions

View File

@ -5,7 +5,7 @@ import { pipeline } from 'node:stream/promises';
import zlib from 'node:zlib';
import process from 'node:process';
import { async as ezspawn } from '@jsdevtools/ez-spawn';
import { exec } from 'tinyexec';
import { mkdirp } from './misc';
import { $fetch } from './make-fetch-happen';
@ -52,7 +52,7 @@ async function ensureMihomoBinary() {
export async function convertClashMetaMrs(type: 'domain', format: 'text', input: string, output: string) {
await ensureMihomoBinary();
const { stderr } = await ezspawn(mihomoBinaryPath, ['convert-ruleset', type, format, input, output]);
const { stderr } = await exec(mihomoBinaryPath, ['convert-ruleset', type, format, input, output]);
if (stderr) {
throw new Error(stderr);

View File

@ -22,7 +22,6 @@
"dependencies": {
"@ghostery/adblocker": "^2.0.4",
"@henrygd/queue": "^1.0.7",
"@jsdevtools/ez-spawn": "^3.0.4",
"async-retry": "^1.3.3",
"async-sema": "^3.1.1",
"better-sqlite3": "^11.5.0",
@ -43,6 +42,7 @@
"picocolors": "^1.1.1",
"punycode": "^2.3.1",
"tar-fs": "^3.0.6",
"tinyexec": "^0.3.1",
"tldts": "^6.1.59",
"tldts-experimental": "^6.1.59",
"undici": "^6.20.1",

39
pnpm-lock.yaml generated
View File

@ -22,9 +22,6 @@ importers:
'@henrygd/queue':
specifier: ^1.0.7
version: 1.0.7
'@jsdevtools/ez-spawn':
specifier: ^3.0.4
version: 3.0.4
async-retry:
specifier: ^1.3.3
version: 1.3.3
@ -85,6 +82,9 @@ importers:
tar-fs:
specifier: ^3.0.6
version: 3.0.6
tinyexec:
specifier: ^0.3.1
version: 0.3.1
tldts:
specifier: ^6.1.59
version: 6.1.59
@ -307,10 +307,6 @@ packages:
resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
'@jsdevtools/ez-spawn@3.0.4':
resolution: {integrity: sha512-f5DRIOZf7wxogefH03RjMPMdBF7ADTWUMoOs9kaJo06EfwF+aFhMZMDZxHg/Xe12hptN9xoZjGso2fdjapBRIA==}
engines: {node: '>=10'}
'@napi-rs/wasm-runtime@0.2.4':
resolution: {integrity: sha512-9zESzOO5aDByvhIAsOy9TbpZ0Ur2AJbUI7UT73kcUTS2mxAMHOBaa1st/jAymNoCtvrit99kkzT1FZuXVcgfIQ==}
@ -808,9 +804,6 @@ packages:
resolution: {integrity: sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww==}
engines: {node: '>=10.6.0'}
call-me-maybe@1.0.2:
resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==}
callsites@3.1.0:
resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==}
engines: {node: '>=6'}
@ -1789,10 +1782,6 @@ packages:
streamx@2.20.0:
resolution: {integrity: sha512-ZGd1LhDeGFucr1CUCTBOS58ZhEendd0ttpGT3usTvosS4ntIwKN9LJFp+OeCSprsCPL14BXVRZlHGRY1V9PVzQ==}
string-argv@0.3.2:
resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==}
engines: {node: '>=0.6.19'}
string-similarity@4.0.4:
resolution: {integrity: sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==}
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
@ -1871,6 +1860,9 @@ packages:
text-table@0.2.0:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
tinyexec@0.3.1:
resolution: {integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==}
tldts-core@6.1.59:
resolution: {integrity: sha512-EiYgNf275AQyVORl8HQYYe7rTVnmLb4hkWK7wAk/12Ksy5EiHpmUmTICa4GojookBPC8qkLMBKKwCmzNA47ZPQ==}
@ -1904,10 +1896,6 @@ packages:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
type-detect@4.0.8:
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
engines: {node: '>=4'}
typescript-eslint@8.12.2:
resolution: {integrity: sha512-UbuVUWSrHVR03q9CWx+JDHeO6B/Hr9p4U5lRH++5tq/EbFq1faYZe50ZSBePptgfIKLEti0aPQ3hFgnPVcd8ZQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@ -2176,13 +2164,6 @@ snapshots:
'@types/yargs': 17.0.33
chalk: 4.1.2
'@jsdevtools/ez-spawn@3.0.4':
dependencies:
call-me-maybe: 1.0.2
cross-spawn: 7.0.3
string-argv: 0.3.2
type-detect: 4.0.8
'@napi-rs/wasm-runtime@0.2.4':
dependencies:
'@emnapi/core': 1.2.0
@ -2717,8 +2698,6 @@ snapshots:
cacheable-lookup@6.1.0: {}
call-me-maybe@1.0.2: {}
callsites@3.1.0: {}
camelcase@6.3.0: {}
@ -3769,8 +3748,6 @@ snapshots:
optionalDependencies:
bare-events: 2.4.2
string-argv@0.3.2: {}
string-similarity@4.0.4: {}
string-width@4.2.3:
@ -3865,6 +3842,8 @@ snapshots:
text-table@0.2.0: {}
tinyexec@0.3.1: {}
tldts-core@6.1.59: {}
tldts-experimental@6.1.59:
@ -3895,8 +3874,6 @@ snapshots:
dependencies:
prelude-ls: 1.2.1
type-detect@4.0.8: {}
typescript-eslint@8.12.2(eslint@9.14.0)(typescript@5.6.3):
dependencies:
'@typescript-eslint/eslint-plugin': 8.12.2(@typescript-eslint/parser@8.12.2(eslint@9.14.0)(typescript@5.6.3))(eslint@9.14.0)(typescript@5.6.3)