diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7873d1856..a79f163b0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [macos-13, ubuntu-22.04, windows-2022] - node: [14, 16, 18, 20, 21] + node: [16, 18, 20, 21] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/package-lock.json b/package-lock.json index 05cd9c655..53134d161 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,8 +17,8 @@ "rcedit": "^4.0.1", "semver": "^7.5.4", "tar": "^6.2.0", - "unzipper": "^0.10.14", - "yargs": "^17.7.2" + "yargs": "^17.7.2", + "yauzl-promise": "^4.0.0" }, "bin": { "nwbuild": "src/cli.js" @@ -59,6 +59,17 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/runtime": { + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.8.tgz", + "integrity": "sha512-Y7KbAP984rn1VGMbGqKmBLio9V7y5Je9GvU4rQPCPinCyNfUcToxIXl06d59URp/F3LwinvODxab5N/G6qggkw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@eggjs/yauzl": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/@eggjs/yauzl/-/yauzl-2.11.0.tgz", @@ -68,6 +79,24 @@ "fd-slicer2": "^1.2.0" } }, + "node_modules/@emnapi/core": { + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-0.45.0.tgz", + "integrity": "sha512-DPWjcUDQkCeEM4VnljEOEcXdAD7pp8zSZsgOujk/LGIwCXWbXJngin+MO4zbH429lzeC3WbYLGjE2MaUOwzpyw==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-0.45.0.tgz", + "integrity": "sha512-Txumi3td7J4A/xTTwlssKieHKTGl3j4A1tglBx72auZ49YK7ePY6XZricgIg9mnZT4xPfA+UPCUdnhRuEFDL+w==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@es-joy/jsdoccomment": { "version": "0.41.0", "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.41.0.tgz", @@ -652,6 +681,255 @@ "node": ">= 10" } }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.1.1.tgz", + "integrity": "sha512-ATj9ua659JgrkICjJscaeZdmPr44cb/KFjNWuD0N6pux0SpzaM7+iOuuK11mAnQM2N9q0DT4REu6NkL8ZEhopw==", + "optional": true, + "dependencies": { + "@emnapi/core": "^0.45.0", + "@emnapi/runtime": "^0.45.0", + "@tybys/wasm-util": "^0.8.1" + } + }, + "node_modules/@node-rs/crc32": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32/-/crc32-1.9.2.tgz", + "integrity": "sha512-fVXjW3YQ+mGJTDRcNIdTXLAAIviV7USeXgN4hh6V2p3S+y6f/gmD+vlbYYVdNmf/1K5LaTHpMWsiByrUnvzp0g==", + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@node-rs/crc32-android-arm-eabi": "1.9.2", + "@node-rs/crc32-android-arm64": "1.9.2", + "@node-rs/crc32-darwin-arm64": "1.9.2", + "@node-rs/crc32-darwin-x64": "1.9.2", + "@node-rs/crc32-freebsd-x64": "1.9.2", + "@node-rs/crc32-linux-arm-gnueabihf": "1.9.2", + "@node-rs/crc32-linux-arm64-gnu": "1.9.2", + "@node-rs/crc32-linux-arm64-musl": "1.9.2", + "@node-rs/crc32-linux-x64-gnu": "1.9.2", + "@node-rs/crc32-linux-x64-musl": "1.9.2", + "@node-rs/crc32-wasm32-wasi": "1.9.2", + "@node-rs/crc32-win32-arm64-msvc": "1.9.2", + "@node-rs/crc32-win32-ia32-msvc": "1.9.2", + "@node-rs/crc32-win32-x64-msvc": "1.9.2" + } + }, + "node_modules/@node-rs/crc32-android-arm-eabi": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-android-arm-eabi/-/crc32-android-arm-eabi-1.9.2.tgz", + "integrity": "sha512-rX6AWO1KwJzih5y4JvbJ2Giq2YtA9oyU6xdCa0BEOeF658eNr+CeoNduXcteXNbGIj/Tf7tg5qK8tzZGSu9zWg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-android-arm64": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-android-arm64/-/crc32-android-arm64-1.9.2.tgz", + "integrity": "sha512-Yp9VJg4HIzdWx9dECQxSrib2+TlPNXgROfo8JrK3MFH/d9dXYNV7W7gl0dAuAOXfJie6Sy3tTGf0ntPWgxs+7g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-darwin-arm64": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-darwin-arm64/-/crc32-darwin-arm64-1.9.2.tgz", + "integrity": "sha512-tIuVhe3K9GHlw1WGzukCQTDQSkkWcasgrKHGRvZf5HXwPq6fnLiyJL4cxfchfW3YRWdGDH+5XTZhvYf/0wLQjg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-darwin-x64": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-darwin-x64/-/crc32-darwin-x64-1.9.2.tgz", + "integrity": "sha512-Lbx0cCNB8fOnuu0LxZQ5Zj+mwD9iLiCnvdX3DR386No8J5/FIHqAYMft1e6CZuM+HE22+k8DqTm0V4dAFU1ZqA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-freebsd-x64": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-freebsd-x64/-/crc32-freebsd-x64-1.9.2.tgz", + "integrity": "sha512-9x3XxwflCgx0vy6n8nZEOKQDEQbcWuzXfmHU9xUWymB7njHko8+Dwl+yfxplDtqyeST6l4obsWut6wGbkgJKHw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-arm-gnueabihf": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm-gnueabihf/-/crc32-linux-arm-gnueabihf-1.9.2.tgz", + "integrity": "sha512-prptitmm8XqbRCazFegtIDMy0ixTIpAHwzJwwRzeveCzd1efTR454TvXjs3pUWnWDM3jKtt5uEVUYnUMvC7dBg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-arm64-gnu": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm64-gnu/-/crc32-linux-arm64-gnu-1.9.2.tgz", + "integrity": "sha512-N9BKb+0IaobXIzBWNkQYtMbWxxwviJtCgOBs0P6DzhRu2Wu8YwYBasnRzCxBrV6MVKpaX4hG1WTdgpZKwMCrbg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-arm64-musl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm64-musl/-/crc32-linux-arm64-musl-1.9.2.tgz", + "integrity": "sha512-/sAQ0TH2Q/HhfTBtEUYr/9fqT/EpXO4HiHyzaXa2TPTAOFbCUw6+oHBe5xTSyQ+2tNQ+eWS3BpxlLhNX2Kojxg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-x64-gnu": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-x64-gnu/-/crc32-linux-x64-gnu-1.9.2.tgz", + "integrity": "sha512-p5qKkIzIvYgF/Nwd2Yqc6L/WqU7pL1jg2ny6ce0eScOwJVofr7kMzkc/n70TWjplM1luqycp1uKEFYQb05Jv3Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-x64-musl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-x64-musl/-/crc32-linux-x64-musl-1.9.2.tgz", + "integrity": "sha512-e5ZrbV366C/U/6jcpi3HiypgMQsvEuVhdBQscNQe/dOH6gURsomquDtJ86kUSpDOS99F/uj7ERaPzonFNdQnXA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-wasm32-wasi": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-wasm32-wasi/-/crc32-wasm32-wasi-1.9.2.tgz", + "integrity": "sha512-GXxw+uIZOyouKN5nU79VRcPwCwqZ3fsR0OzB9LzDl6N+tlfR9Ys7I0XudlOCcGhx7NZjMPe94bBwh5aAHDWxXg==", + "cpu": [ + "wasm32" + ], + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.1.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@node-rs/crc32-win32-arm64-msvc": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-arm64-msvc/-/crc32-win32-arm64-msvc-1.9.2.tgz", + "integrity": "sha512-Z3/GkeVCvk4hZU53qujPCEUX7jg09Lj3InoMZpX88W2fb5Yw+NE0aQ1GFz9wHAqTlGql02/idN7ncfwIlb5iMw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-win32-ia32-msvc": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-ia32-msvc/-/crc32-win32-ia32-msvc-1.9.2.tgz", + "integrity": "sha512-rf8qjKxhHfblf1VlZirNFYFlSaAWiCxo6ZBp4//8+gDwn5e5gtUeJ3yKR+MV0iEdLpnooBwY3vFNDGJp91eC4A==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-win32-x64-msvc": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-x64-msvc/-/crc32-win32-x64-msvc-1.9.2.tgz", + "integrity": "sha512-z5tnkkNaEcxwDRVZTjs9SZO9f6HsDttVhIhisECBm5DQIx8fWc2cRBTGIU0Kdg4I+89B1r3QzMbYzyq7ugui2g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -915,6 +1193,15 @@ "eslint": ">=8.40.0" } }, + "node_modules/@tybys/wasm-util": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.8.1.tgz", + "integrity": "sha512-GSsTwyBl4pIzsxAY5wroZdyQKyhXk0d8PCRZtrSZ2WEB1cBdrp2EgGBwHOGCZtIIPun/DL3+AykCv+J6fyRH4Q==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -1215,26 +1502,6 @@ } ] }, - "node_modules/big-integer": { - "version": "1.6.52", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", - "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==", - "dependencies": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/bl": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", @@ -1254,6 +1521,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1286,22 +1554,6 @@ "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==" }, - "node_modules/buffer-indexof-polyfill": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", - "engines": { - "node": ">=0.2.0" - } - }, "node_modules/builtin-modules": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", @@ -1384,17 +1636,6 @@ "node": ">=4" } }, - "node_modules/chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==", - "dependencies": { - "traverse": ">=0.3.0 <0.4" - }, - "engines": { - "node": "*" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1565,7 +1806,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/core-util-is": { "version": "1.0.3", @@ -1651,6 +1893,35 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -1672,14 +1943,6 @@ "node": ">=6.0.0" } }, - "node_modules/duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", - "dependencies": { - "readable-stream": "^2.0.2" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2138,7 +2401,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/fsevents": { "version": "2.3.3", @@ -2154,48 +2418,12 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fstream/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-caller-file": { @@ -2215,6 +2443,20 @@ "node": "*" } }, + "node_modules/get-intrinsic": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "dependencies": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-ready": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-ready/-/get-ready-1.0.0.tgz", @@ -2314,6 +2556,31 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -2334,6 +2601,50 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dependencies": { + "get-intrinsic": "^1.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/http-cache-semantics": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", @@ -2434,6 +2745,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -2560,6 +2872,18 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/is-it-type": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/is-it-type/-/is-it-type-5.1.2.tgz", + "integrity": "sha512-q/gOZQTNYABAxaXWnBKZjTFH4yACvWEFtgVOj+LbgxYIgAJG1xVmUZOsECSrZPIemYUQvaQWVilSFVbh4Eyt8A==", + "dependencies": { + "@babel/runtime": "^7.16.7", + "globalthis": "^1.0.2" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/is-lambda": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", @@ -2789,11 +3113,6 @@ "uc.micro": "^1.0.1" } }, - "node_modules/listenercount": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", - "integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==" - }, "node_modules/local-pkg": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", @@ -3187,6 +3506,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -3472,6 +3792,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3605,6 +3933,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3848,6 +4177,11 @@ "util-deprecate": "~1.0.1" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4049,7 +4383,8 @@ "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true }, "node_modules/shebang-command": { "version": "2.0.0", @@ -4087,6 +4422,14 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/simple-invariant": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/simple-invariant/-/simple-invariant-2.0.1.tgz", + "integrity": "sha512-1sbhsxqI+I2tqlmjbz99GXNmZtr6tKIyEgGGnJw/MKGblalqk/XoOYYFJlBzTKZCxx8kLaD3FD5s9BEEjx5Pyg==", + "engines": { + "node": ">=10" + } + }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -4411,13 +4754,11 @@ "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" }, - "node_modules/traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==", - "engines": { - "node": "*" - } + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "optional": true }, "node_modules/type-check": { "version": "0.4.0", @@ -4505,28 +4846,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/unzipper": { - "version": "0.10.14", - "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", - "integrity": "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==", - "dependencies": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, - "node_modules/unzipper/node_modules/bluebird": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", - "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==" - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -4890,6 +5209,19 @@ "node": ">=12" } }, + "node_modules/yauzl-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yauzl-promise/-/yauzl-promise-4.0.0.tgz", + "integrity": "sha512-/HCXpyHXJQQHvFq9noqrjfa/WpQC2XYs3vI7tBiAi4QiIU1knvYhZGaO1QPjwIVMdqflxbmwgMXtYeaRiAE0CA==", + "dependencies": { + "@node-rs/crc32": "^1.7.0", + "is-it-type": "^5.1.2", + "simple-invariant": "^2.0.1" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/yazl": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", diff --git a/package.json b/package.json index 35c3dee68..3da7a66c4 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "url": "https://github.com/nwutils/nw-builder.git" }, "scripts": { - "lint": "eslint ./**/*.{js,md}", + "lint": "eslint ./src/**/*.js ./test/**/*.js", "lint:fix": "eslint --fix ./**/*.{js,md} && markdownlint --fix ./README.md", "docs": "jsdoc -d docs ./README.md ./src/index.js ./src/get.js ./src/run.js ./src/bld.js", "test": "vitest", @@ -67,8 +67,8 @@ "rcedit": "^4.0.1", "semver": "^7.5.4", "tar": "^6.2.0", - "unzipper": "^0.10.14", - "yargs": "^17.7.2" + "yargs": "^17.7.2", + "yauzl-promise": "^4.0.0" }, "packageManager": "npm@10.3.0", "engines": { diff --git a/src/get.js b/src/get.js index 43217d569..52d5e9572 100644 --- a/src/get.js +++ b/src/get.js @@ -1,11 +1,9 @@ import fs from "node:fs"; -import fsm from "node:fs/promises"; import https from "node:https"; import path from "node:path"; import progress from "cli-progress"; import tar from "tar"; -import unzipper from "unzipper"; import util from "./util.js"; @@ -32,7 +30,7 @@ import util from "./util.js"; */ async function get(options) { if (fs.existsSync(options.cacheDir) === false) { - await fsm.mkdir(options.cacheDir, { recursive: true }); + await fs.promises.mkdir(options.cacheDir, { recursive: true }); } await getNwjs(options); if (options.ffmpeg === true) { @@ -52,14 +50,14 @@ const getNwjs = async (options) => { ); // If options.cache is false, remove cache. if (options.cache === false) { - await fsm.rm(out, { + await fs.promises.rm(out, { recursive: true, force: true, }); } if (fs.existsSync(out) === true) { - await fsm.rm( + await fs.promises.rm( path.resolve( options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, @@ -72,11 +70,7 @@ const getNwjs = async (options) => { C: options.cacheDir }); } else { - await new Promise((res) => { - fs.createReadStream(out) - .pipe(unzipper.Extract({ path: options.cacheDir })) - .on("finish", res); - }); + await util.unzip(out, options.cacheDir); if (options.platform === "osx") { await createSymlinks(options); } @@ -136,7 +130,7 @@ const getNwjs = async (options) => { }); await request; - await fsm.rm( + await fs.promises.rm( path.resolve( options.cacheDir, `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`, @@ -149,11 +143,7 @@ const getNwjs = async (options) => { C: options.cacheDir }); } else { - await new Promise((res) => { - fs.createReadStream(out) - .pipe(unzipper.Extract({ path: options.cacheDir })) - .on("finish", res); - }); + await util.unzip(out, options.cacheDir); if (options.platform === "osx") { await createSymlinks(options); } @@ -176,7 +166,7 @@ const getFfmpeg = async (options) => { // If options.cache is false, remove cache. if (options.cache === false) { - await fsm.rm(out, { + await fs.promises.rm(out, { recursive: true, force: true, }); @@ -184,8 +174,7 @@ const getFfmpeg = async (options) => { // Check if cache exists. if (fs.existsSync(out) === true) { - fs.createReadStream(out) - .pipe(unzipper.Extract({ path: nwDir })); + await util.unzip(out, nwDir); return; } @@ -224,8 +213,7 @@ const getFfmpeg = async (options) => { // Remove compressed file after download and decompress. await request; - fs.createReadStream(out) - .pipe(unzipper.Extract({ path: nwDir })); + await util.unzip(out, nwDir); await util.replaceFfmpeg(options.platform, nwDir); } @@ -238,7 +226,7 @@ const getNodeHeaders = async (options) => { // If options.cache is false, remove cache. if (options.cache === false) { - await fsm.rm(out, { + await fs.promises.rm(out, { recursive: true, force: true, }); @@ -249,11 +237,11 @@ const getNodeHeaders = async (options) => { file: out, C: options.cacheDir }); - await fsm.rm(path.resolve(options.cacheDir, `node-v${options.version}-${options.platform}-${options.arch}`), { + await fs.promises.rm(path.resolve(options.cacheDir, `node-v${options.version}-${options.platform}-${options.arch}`), { recursive: true, force: true, }); - await fsm.rename( + await fs.promises.rename( path.resolve(options.cacheDir, "node"), path.resolve(options.cacheDir, `node-v${options.version}-${options.platform}-${options.arch}`), ); @@ -290,7 +278,7 @@ const getNodeHeaders = async (options) => { file: out, C: options.cacheDir }); - await fsm.rename( + await fs.promises.rename( path.resolve(options.cacheDir, "node"), path.resolve(options.cacheDir, `node-v${options.version}-${options.platform}-${options.arch}`), ); @@ -306,9 +294,10 @@ const createSymlinks = async (options) => { path.join(frameworksPath, "Versions", "Current"), ]; for await (const symlink of symlinks) { - const link = String(await fsm.readFile(symlink)); - await fsm.rm(symlink); - await fsm.symlink(link, symlink); + const buffer = await fs.promises.readFile(symlink); + const link = buffer.toString(); + await fs.promises.rm(symlink); + await fs.promises.symlink(link, symlink); } }; diff --git a/src/util.js b/src/util.js index 4d8bd9d85..68053e1bd 100644 --- a/src/util.js +++ b/src/util.js @@ -3,9 +3,11 @@ import fs from "node:fs"; import https from "node:https"; import path from "node:path"; import process from "node:process"; +import stream from "node:stream"; import * as GlobModule from "glob"; import semver from "semver"; +import yauzl from "yauzl-promise"; /** * Get manifest (array of NW release metadata) from URL @@ -166,7 +168,7 @@ const replaceFfmpeg = async (platform, nwDir) => { * @param {object} options - glob file options * @param {string | string[]} options.srcDir - app src dir * @param {boolean} options.glob - glob flag - * @returns {string[]} - Returns array of file paths + * @returns {Promise} - Returns array of file paths */ async function globFiles({ @@ -468,4 +470,40 @@ async function getPath(type, options) { } } -export default { getReleaseInfo, getPath, PLATFORM_KV, ARCH_KV, EXE_NAME, replaceFfmpeg, globFiles, getNodeManifest, parse, validate }; \ No newline at end of file +/** + * Wrapper for unzipping using `yauzl-promise`. + * + * @async + * @function + * @param {string} nwZip - file path to .zip file + * @param {string} cacheDir - directory to unzip in + */ +async function unzip(nwZip, cacheDir) { + const zip = await yauzl.open(nwZip, { + supportMacArchive: false + }); + try { + for await (const entry of zip) { + const fullEntryPath = path.resolve(cacheDir, entry.filename); + + if (entry.filename.endsWith("/")) { + // Create directory + await fs.promises.mkdir(fullEntryPath, { recursive: true }); + } else { + // Create the file's directory first, if it doesn't exist + const directory = path.dirname(fullEntryPath); + await fs.promises.mkdir(directory, { recursive: true }); + + const readStream = await entry.openReadStream(); + const writeStream = fs.createWriteStream(fullEntryPath); + await stream.promises.pipeline(readStream, writeStream); + } + } + } catch (e) { + console.error(e); + } finally { + await zip.close(); + } +} + +export default { getReleaseInfo, getPath, PLATFORM_KV, ARCH_KV, EXE_NAME, replaceFfmpeg, globFiles, getNodeManifest, parse, unzip, validate }; diff --git a/test/specs/mode.test.js b/test/specs/bld.test.js similarity index 66% rename from test/specs/mode.test.js rename to test/specs/bld.test.js index 9fe6d88af..43969c550 100644 --- a/test/specs/mode.test.js +++ b/test/specs/bld.test.js @@ -6,35 +6,49 @@ import { By } from "selenium-webdriver"; import chrome from "selenium-webdriver/chrome.js"; import { beforeAll, describe, it } from "vitest"; -import nwbuild from "../../src/index.js"; +import build from "../../src/bld.js"; +import get from "../../src/get.js"; import util from "../../src/util.js"; const { Driver, ServiceBuilder, Options } = chrome; -describe("test modes", async () => { +describe("build", async () => { let driver = undefined; - let nwOptions = { + const nwOptions = { srcDir: "test/fixture/app", mode: "build", version: "0.83.0", flavor: "sdk", platform: util.PLATFORM_KV[process.platform], arch: util.ARCH_KV[process.arch], + downloadUrl: "https://dl.nwjs.io", + manifestUrl: "https://nwjs.io/versions", outDir: "test/fixture/out/app", cacheDir: "test/fixture/cache", + cache: true, + ffmpeg: false, glob: false, + managedManifest: false, nativeAddon: false, + zip: false, + app: { + name: "demo" + } }; beforeAll(async () => { - await nwbuild({ ...nwOptions }); + await get(nwOptions); }, Infinity); - it("should run", async () => { + it("should build without errors", async () => { + await build(nwOptions); + }); + + it.skip("should run after build", async () => { const options = new Options(); const args = [ - `--nwapp=${path.resolve("test", "fixture", "out", "app", "package.nw")}`, + `--nwapp=${path.resolve("test", "fixture", "app")}`, "--headless=new", ]; options.addArguments(args); @@ -46,5 +60,5 @@ describe("test modes", async () => { driver = Driver.createSession(options, service); const text = await driver.findElement(By.id("test")).getText(); assert.strictEqual(text, "Hello, World!"); - }); + }, { timeout: Infinity }); });