diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..6b80765 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" + diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..da3f3ae --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,319 @@ +name: CI +env: + DEBUG: napi:* + APP_NAME: bncsutil-node + MACOSX_DEPLOYMENT_TARGET: '10.13' +'on': + push: + branches: + - main + tags-ignore: + - '**' + pull_request: null +jobs: + build: + if: '!contains(github.event.head_commit.message, ''skip ci'')' + strategy: + fail-fast: false + matrix: + settings: + - host: macos-latest + target: x86_64-apple-darwin + build: | + yarn build + strip -x *.node + - host: windows-latest + build: yarn build + target: x86_64-pc-windows-msvc + - host: ubuntu-latest + target: x86_64-unknown-linux-gnu + docker: | + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL + docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian + docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder + build: | + docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip bncsutil-node.linux-x64-gnu.node + - host: macos-latest + target: aarch64-apple-darwin + build: | + yarn build --target=aarch64-apple-darwin + strip -x *.node + - host: ubuntu-latest + target: aarch64-unknown-linux-gnu + setup: | + sudo apt-get update + sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y + build: | + yarn build --target=aarch64-unknown-linux-gnu + aarch64-linux-gnu-strip bncsutil-node.linux-arm64-gnu.node + - host: ubuntu-latest + target: aarch64-linux-android + build: | + export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang" + yarn build --target aarch64-linux-android + name: stable - ${{ matrix.settings.target }} - node@20 + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: 20 + check-latest: true + - name: Install + uses: actions-rs/toolchain@v1 + with: + profile: minimal + override: true + toolchain: stable + target: ${{ matrix.settings.target }} + - name: Generate Cargo.lock + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - name: Cache cargo registry + uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ matrix.settings.target }}-node@20-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v2 + with: + path: ~/.cargo/git + key: ${{ matrix.settings.target }}-node@20-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: npm-cache-${{ matrix.settings.target }}-node@20-${{ hashFiles('yarn.lock') }} + - name: Pull latest image + run: ${{ matrix.settings.docker }} + env: + DOCKER_REGISTRY_URL: ghcr.io + DOCKER_USERNAME: ${{ github.actor }} + DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + if: ${{ matrix.settings.docker }} + - name: Setup toolchain + run: ${{ matrix.settings.setup }} + if: ${{ matrix.settings.setup }} + shell: bash + - name: Install dependencies + run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + - name: Build + run: ${{ matrix.settings.build }} + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: bindings-${{ matrix.settings.target }} + path: ${{ env.APP_NAME }}.*.node + build-freebsd: + runs-on: macos-10.15 + name: Build FreeBSD + steps: + - uses: actions/checkout@v2 + - name: Build + id: build + uses: vmactions/freebsd-vm@v0.1.5 + env: + DEBUG: napi:* + RUSTUP_HOME: /usr/local/rustup + CARGO_HOME: /usr/local/cargo + RUSTUP_IO_THREADS: 1 + with: + envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS + usesh: true + mem: 3000 + prepare: | + pkg install -y curl node20 python2 + curl -qL https://www.npmjs.com/install.sh | sh + npm install -g yarn + curl https://sh.rustup.rs -sSf --output rustup.sh + sh rustup.sh -y --profile minimal --default-toolchain stable + export PATH="/usr/local/cargo/bin:$PATH" + echo "~~~~ rustc --version ~~~~" + rustc --version + echo "~~~~ node -v ~~~~" + node -v + echo "~~~~ yarn --version ~~~~" + yarn --version + run: | + export PATH="/usr/local/cargo/bin:$PATH" + pwd + ls -lah + whoami + env + freebsd-version + yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + yarn build + yarn test + rm -rf node_modules + rm -rf target + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: bindings-freebsd + path: ${{ env.APP_NAME }}.*.node + test-macOS-windows-binding: + name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + settings: + - host: windows-latest + target: x86_64-pc-windows-msvc + node: + - '18' + - '19' + - '20' + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + check-latest: true + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: bindings-${{ matrix.settings.target }} + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Test bindings + run: yarn test + test-linux-x64-gnu-binding: + name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - '19' + - '20' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + check-latest: true + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: bindings-x86_64-unknown-linux-gnu + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Test bindings + run: docker run --rm -v $(pwd):/bncsutil-node -w /bncsutil-node node:${{ matrix.node }}-slim yarn test + test-linux-aarch64-gnu-binding: + name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - '19' + - '20' + runs-on: ubuntu-latest + steps: + - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset + - uses: actions/checkout@v2 + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: bindings-aarch64-unknown-linux-gnu + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: npm-cache-test-linux-aarch64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + - name: Setup and run tests + uses: addnab/docker-run-action@v3 + with: + image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }} + options: '-v ${{ github.workspace }}:/build -w /build' + run: | + set -e + yarn test + ls -la + publish: + name: Publish + runs-on: ubuntu-latest + needs: + - build-freebsd + - test-macOS-windows-binding + - test-linux-x64-gnu-binding + - test-linux-aarch64-gnu-binding + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: 20 + check-latest: true + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: npm-cache-ubuntu-latest-${{ hashFiles('yarn.lock') }} + restore-keys: | + npm-cache- + - name: Install dependencies + run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 + - name: Download all artifacts + uses: actions/download-artifact@v2 + with: + path: artifacts + - name: Move artifacts + run: yarn artifacts + - name: List packages + run: ls -R ./npm + shell: bash + - name: Publish + run: | + if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --access public + elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --tag next --access public + else + echo "Not a release, skipping publish" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index f45ed06..207297a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ native/bncsutil/build/CMakeFiles **/.DS_Store ./.idea .idea +target +*.node +artifacts.json +bncsutil/build/CMakeFiles +node_modules \ No newline at end of file diff --git a/.npmignore b/.npmignore index 10a0760..f96abe0 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,10 @@ -native/target -native/index.node -native/artifacts.json +target +Cargo.lock +.cargo +.github +npm +.eslintrc +.prettierignore +rustfmt.toml +yarn.lock +*.node diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 68d80cb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -notifications: - email: false - -matrix: - include: - - language: rust - rust: - - stable - jobs: - allow_failures: - - rust: nightly - fast_finish: true - - language: node_js - node_js: - - 'lts/*' - script: - - npm install - - npm test diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..0209786 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,299 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "bitflags" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "bncsutil-node" +version = "0.1.0" +dependencies = [ + "cmake", + "libc", + "napi", + "napi-build", + "napi-derive", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "ctor" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "libc" +version = "0.2.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" + +[[package]] +name = "libloading" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +dependencies = [ + "cfg-if", + "windows-sys", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "napi" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbf98e1bcb85cc441bbf7cdfb11070d2537a100e2697d75397b2584c32492d1" +dependencies = [ + "bitflags", + "ctor", + "napi-derive", + "napi-sys", + "once_cell", +] + +[[package]] +name = "napi-build" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b4532cf86bfef556348ac65e561e3123879f0e7566cca6d43a6ff5326f13df" + +[[package]] +name = "napi-derive" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7622f0dbe0968af2dacdd64870eee6dee94f93c989c841f1ad8f300cf1abd514" +dependencies = [ + "cfg-if", + "convert_case", + "napi-derive-backend", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "napi-derive-backend" +version = "1.0.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec514d65fce18a959be55e7f683ac89c6cb850fb59b09e25ab777fd5a4a8d9e" +dependencies = [ + "convert_case", + "once_cell", + "proc-macro2", + "quote", + "regex", + "semver", + "syn", +] + +[[package]] +name = "napi-sys" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2503fa6af34dc83fb74888df8b22afe933b58d37daf7d80424b1c60c68196b8b" +dependencies = [ + "libloading", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "semver" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/native/Cargo.toml b/Cargo.toml similarity index 73% rename from native/Cargo.toml rename to Cargo.toml index 960b984..c8029ef 100644 --- a/native/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [package] +edition = "2018" name = "bncsutil-node" version = "0.1.0" authors = ["Nikolay Kostyurin "] @@ -7,14 +8,17 @@ exclude = ["artifacts.json", "index.node"] build = "build.rs" [lib] -name = "bncsutil_node" crate-type = ["cdylib"] +name = "bncsutil_node" + +[dependencies] +napi = "2.15.0" +napi-derive = "2.15.0" +libc = "0.2" [build-dependencies] -neon-build = "0.10.1" +napi-build = "2.1.0" cmake = "0.1" -[dependencies] -neon = "0.10.1" -libc = "0.2" -# gmp-mpfr-sys = "1.6.2" +[profile.release] +lto = true diff --git a/native/bncsutil/CMake/Modules/FindGMP.cmake b/bncsutil/CMake/Modules/FindGMP.cmake similarity index 100% rename from native/bncsutil/CMake/Modules/FindGMP.cmake rename to bncsutil/CMake/Modules/FindGMP.cmake diff --git a/native/bncsutil/CMake/Modules/FindMPIR.cmake b/bncsutil/CMake/Modules/FindMPIR.cmake similarity index 100% rename from native/bncsutil/CMake/Modules/FindMPIR.cmake rename to bncsutil/CMake/Modules/FindMPIR.cmake diff --git a/native/bncsutil/CMakeFiles/3.12.1/CMakeCCompiler.cmake b/bncsutil/CMakeFiles/3.12.1/CMakeCCompiler.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CMakeCCompiler.cmake rename to bncsutil/CMakeFiles/3.12.1/CMakeCCompiler.cmake diff --git a/native/bncsutil/CMakeFiles/3.12.1/CMakeCXXCompiler.cmake b/bncsutil/CMakeFiles/3.12.1/CMakeCXXCompiler.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CMakeCXXCompiler.cmake rename to bncsutil/CMakeFiles/3.12.1/CMakeCXXCompiler.cmake diff --git a/native/bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_C.bin b/bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_C.bin similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_C.bin rename to bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_C.bin diff --git a/native/bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_CXX.bin b/bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_CXX.bin similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_CXX.bin rename to bncsutil/CMakeFiles/3.12.1/CMakeDetermineCompilerABI_CXX.bin diff --git a/native/bncsutil/CMakeFiles/3.12.1/CMakeSystem.cmake b/bncsutil/CMakeFiles/3.12.1/CMakeSystem.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CMakeSystem.cmake rename to bncsutil/CMakeFiles/3.12.1/CMakeSystem.cmake diff --git a/native/bncsutil/CMakeFiles/3.12.1/CompilerIdC/CMakeCCompilerId.c b/bncsutil/CMakeFiles/3.12.1/CompilerIdC/CMakeCCompilerId.c similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CompilerIdC/CMakeCCompilerId.c rename to bncsutil/CMakeFiles/3.12.1/CompilerIdC/CMakeCCompilerId.c diff --git a/native/bncsutil/CMakeFiles/3.12.1/CompilerIdC/a.out b/bncsutil/CMakeFiles/3.12.1/CompilerIdC/a.out similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CompilerIdC/a.out rename to bncsutil/CMakeFiles/3.12.1/CompilerIdC/a.out diff --git a/native/bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/CMakeCXXCompilerId.cpp b/bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/CMakeCXXCompilerId.cpp similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/CMakeCXXCompilerId.cpp rename to bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/CMakeCXXCompilerId.cpp diff --git a/native/bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/a.out b/bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/a.out similarity index 100% rename from native/bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/a.out rename to bncsutil/CMakeFiles/3.12.1/CompilerIdCXX/a.out diff --git a/native/bncsutil/CMakeFiles/CMakeOutput.log b/bncsutil/CMakeFiles/CMakeOutput.log similarity index 100% rename from native/bncsutil/CMakeFiles/CMakeOutput.log rename to bncsutil/CMakeFiles/CMakeOutput.log diff --git a/native/bncsutil/CMakeFiles/Makefile2 b/bncsutil/CMakeFiles/Makefile2 similarity index 100% rename from native/bncsutil/CMakeFiles/Makefile2 rename to bncsutil/CMakeFiles/Makefile2 diff --git a/native/bncsutil/CMakeFiles/TargetDirectories.txt b/bncsutil/CMakeFiles/TargetDirectories.txt similarity index 100% rename from native/bncsutil/CMakeFiles/TargetDirectories.txt rename to bncsutil/CMakeFiles/TargetDirectories.txt diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/DependInfo.cmake b/bncsutil/CMakeFiles/bncsutil.dir/DependInfo.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/DependInfo.cmake rename to bncsutil/CMakeFiles/bncsutil.dir/DependInfo.cmake diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/build.make b/bncsutil/CMakeFiles/bncsutil.dir/build.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/build.make rename to bncsutil/CMakeFiles/bncsutil.dir/build.make diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/cmake_clean.cmake b/bncsutil/CMakeFiles/bncsutil.dir/cmake_clean.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/cmake_clean.cmake rename to bncsutil/CMakeFiles/bncsutil.dir/cmake_clean.cmake diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/depend.make b/bncsutil/CMakeFiles/bncsutil.dir/depend.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/depend.make rename to bncsutil/CMakeFiles/bncsutil.dir/depend.make diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/flags.make b/bncsutil/CMakeFiles/bncsutil.dir/flags.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/flags.make rename to bncsutil/CMakeFiles/bncsutil.dir/flags.make diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/link.txt b/bncsutil/CMakeFiles/bncsutil.dir/link.txt similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/link.txt rename to bncsutil/CMakeFiles/bncsutil.dir/link.txt diff --git a/native/bncsutil/CMakeFiles/bncsutil.dir/progress.make b/bncsutil/CMakeFiles/bncsutil.dir/progress.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil.dir/progress.make rename to bncsutil/CMakeFiles/bncsutil.dir/progress.make diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/DependInfo.cmake b/bncsutil/CMakeFiles/bncsutil_static.dir/DependInfo.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/DependInfo.cmake rename to bncsutil/CMakeFiles/bncsutil_static.dir/DependInfo.cmake diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/build.make b/bncsutil/CMakeFiles/bncsutil_static.dir/build.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/build.make rename to bncsutil/CMakeFiles/bncsutil_static.dir/build.make diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean.cmake b/bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean.cmake rename to bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean.cmake diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean_target.cmake b/bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean_target.cmake similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean_target.cmake rename to bncsutil/CMakeFiles/bncsutil_static.dir/cmake_clean_target.cmake diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/depend.make b/bncsutil/CMakeFiles/bncsutil_static.dir/depend.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/depend.make rename to bncsutil/CMakeFiles/bncsutil_static.dir/depend.make diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/flags.make b/bncsutil/CMakeFiles/bncsutil_static.dir/flags.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/flags.make rename to bncsutil/CMakeFiles/bncsutil_static.dir/flags.make diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/link.txt b/bncsutil/CMakeFiles/bncsutil_static.dir/link.txt similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/link.txt rename to bncsutil/CMakeFiles/bncsutil_static.dir/link.txt diff --git a/native/bncsutil/CMakeFiles/bncsutil_static.dir/progress.make b/bncsutil/CMakeFiles/bncsutil_static.dir/progress.make similarity index 100% rename from native/bncsutil/CMakeFiles/bncsutil_static.dir/progress.make rename to bncsutil/CMakeFiles/bncsutil_static.dir/progress.make diff --git a/native/bncsutil/CMakeFiles/cmake.check_cache b/bncsutil/CMakeFiles/cmake.check_cache similarity index 100% rename from native/bncsutil/CMakeFiles/cmake.check_cache rename to bncsutil/CMakeFiles/cmake.check_cache diff --git a/native/bncsutil/CMakeFiles/feature_tests.bin b/bncsutil/CMakeFiles/feature_tests.bin similarity index 100% rename from native/bncsutil/CMakeFiles/feature_tests.bin rename to bncsutil/CMakeFiles/feature_tests.bin diff --git a/native/bncsutil/CMakeFiles/feature_tests.c b/bncsutil/CMakeFiles/feature_tests.c similarity index 100% rename from native/bncsutil/CMakeFiles/feature_tests.c rename to bncsutil/CMakeFiles/feature_tests.c diff --git a/native/bncsutil/CMakeFiles/feature_tests.cxx b/bncsutil/CMakeFiles/feature_tests.cxx similarity index 100% rename from native/bncsutil/CMakeFiles/feature_tests.cxx rename to bncsutil/CMakeFiles/feature_tests.cxx diff --git a/native/bncsutil/CMakeFiles/progress.marks b/bncsutil/CMakeFiles/progress.marks similarity index 100% rename from native/bncsutil/CMakeFiles/progress.marks rename to bncsutil/CMakeFiles/progress.marks diff --git a/native/bncsutil/CMakeLists.txt b/bncsutil/CMakeLists.txt similarity index 100% rename from native/bncsutil/CMakeLists.txt rename to bncsutil/CMakeLists.txt diff --git a/native/bncsutil/COPYING b/bncsutil/COPYING similarity index 100% rename from native/bncsutil/COPYING rename to bncsutil/COPYING diff --git a/native/bncsutil/README.md b/bncsutil/README.md similarity index 100% rename from native/bncsutil/README.md rename to bncsutil/README.md diff --git a/native/bncsutil/depends/include/README.txt b/bncsutil/depends/include/README.txt similarity index 100% rename from native/bncsutil/depends/include/README.txt rename to bncsutil/depends/include/README.txt diff --git a/native/bncsutil/depends/include/gmp.h b/bncsutil/depends/include/gmp.h similarity index 100% rename from native/bncsutil/depends/include/gmp.h rename to bncsutil/depends/include/gmp.h diff --git a/native/bncsutil/depends/lib/README.txt b/bncsutil/depends/lib/README.txt similarity index 100% rename from native/bncsutil/depends/lib/README.txt rename to bncsutil/depends/lib/README.txt diff --git a/native/bncsutil/depends/lib/gmp.lib b/bncsutil/depends/lib/gmp.lib similarity index 100% rename from native/bncsutil/depends/lib/gmp.lib rename to bncsutil/depends/lib/gmp.lib diff --git a/native/bncsutil/src/bncsutil/Makefile b/bncsutil/src/bncsutil/Makefile similarity index 100% rename from native/bncsutil/src/bncsutil/Makefile rename to bncsutil/src/bncsutil/Makefile diff --git a/native/bncsutil/src/bncsutil/bncsutil.h b/bncsutil/src/bncsutil/bncsutil.h similarity index 100% rename from native/bncsutil/src/bncsutil/bncsutil.h rename to bncsutil/src/bncsutil/bncsutil.h diff --git a/native/bncsutil/src/bncsutil/bsha1.cpp b/bncsutil/src/bncsutil/bsha1.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/bsha1.cpp rename to bncsutil/src/bncsutil/bsha1.cpp diff --git a/native/bncsutil/src/bncsutil/bsha1.h b/bncsutil/src/bncsutil/bsha1.h similarity index 100% rename from native/bncsutil/src/bncsutil/bsha1.h rename to bncsutil/src/bncsutil/bsha1.h diff --git a/native/bncsutil/src/bncsutil/buffer.h b/bncsutil/src/bncsutil/buffer.h similarity index 100% rename from native/bncsutil/src/bncsutil/buffer.h rename to bncsutil/src/bncsutil/buffer.h diff --git a/native/bncsutil/src/bncsutil/cdkeydecoder.cpp b/bncsutil/src/bncsutil/cdkeydecoder.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/cdkeydecoder.cpp rename to bncsutil/src/bncsutil/cdkeydecoder.cpp diff --git a/native/bncsutil/src/bncsutil/cdkeydecoder.h b/bncsutil/src/bncsutil/cdkeydecoder.h similarity index 100% rename from native/bncsutil/src/bncsutil/cdkeydecoder.h rename to bncsutil/src/bncsutil/cdkeydecoder.h diff --git a/native/bncsutil/src/bncsutil/checkrevision.cpp b/bncsutil/src/bncsutil/checkrevision.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/checkrevision.cpp rename to bncsutil/src/bncsutil/checkrevision.cpp diff --git a/native/bncsutil/src/bncsutil/checkrevision.h b/bncsutil/src/bncsutil/checkrevision.h similarity index 100% rename from native/bncsutil/src/bncsutil/checkrevision.h rename to bncsutil/src/bncsutil/checkrevision.h diff --git a/native/bncsutil/src/bncsutil/decodekey.cpp b/bncsutil/src/bncsutil/decodekey.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/decodekey.cpp rename to bncsutil/src/bncsutil/decodekey.cpp diff --git a/native/bncsutil/src/bncsutil/decodekey.h b/bncsutil/src/bncsutil/decodekey.h similarity index 100% rename from native/bncsutil/src/bncsutil/decodekey.h rename to bncsutil/src/bncsutil/decodekey.h diff --git a/native/bncsutil/src/bncsutil/file.cpp b/bncsutil/src/bncsutil/file.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/file.cpp rename to bncsutil/src/bncsutil/file.cpp diff --git a/native/bncsutil/src/bncsutil/file.h b/bncsutil/src/bncsutil/file.h similarity index 100% rename from native/bncsutil/src/bncsutil/file.h rename to bncsutil/src/bncsutil/file.h diff --git a/native/bncsutil/src/bncsutil/keytables.h b/bncsutil/src/bncsutil/keytables.h similarity index 100% rename from native/bncsutil/src/bncsutil/keytables.h rename to bncsutil/src/bncsutil/keytables.h diff --git a/native/bncsutil/src/bncsutil/libinfo.cpp b/bncsutil/src/bncsutil/libinfo.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/libinfo.cpp rename to bncsutil/src/bncsutil/libinfo.cpp diff --git a/native/bncsutil/src/bncsutil/libinfo.h b/bncsutil/src/bncsutil/libinfo.h similarity index 100% rename from native/bncsutil/src/bncsutil/libinfo.h rename to bncsutil/src/bncsutil/libinfo.h diff --git a/native/bncsutil/src/bncsutil/ms_stdint.h b/bncsutil/src/bncsutil/ms_stdint.h similarity index 100% rename from native/bncsutil/src/bncsutil/ms_stdint.h rename to bncsutil/src/bncsutil/ms_stdint.h diff --git a/native/bncsutil/src/bncsutil/mutil.h b/bncsutil/src/bncsutil/mutil.h similarity index 100% rename from native/bncsutil/src/bncsutil/mutil.h rename to bncsutil/src/bncsutil/mutil.h diff --git a/native/bncsutil/src/bncsutil/mutil_types.h b/bncsutil/src/bncsutil/mutil_types.h similarity index 100% rename from native/bncsutil/src/bncsutil/mutil_types.h rename to bncsutil/src/bncsutil/mutil_types.h diff --git a/native/bncsutil/src/bncsutil/nls.c b/bncsutil/src/bncsutil/nls.c similarity index 100% rename from native/bncsutil/src/bncsutil/nls.c rename to bncsutil/src/bncsutil/nls.c diff --git a/native/bncsutil/src/bncsutil/nls.h b/bncsutil/src/bncsutil/nls.h similarity index 100% rename from native/bncsutil/src/bncsutil/nls.h rename to bncsutil/src/bncsutil/nls.h diff --git a/native/bncsutil/src/bncsutil/oldauth.cpp b/bncsutil/src/bncsutil/oldauth.cpp similarity index 100% rename from native/bncsutil/src/bncsutil/oldauth.cpp rename to bncsutil/src/bncsutil/oldauth.cpp diff --git a/native/bncsutil/src/bncsutil/oldauth.h b/bncsutil/src/bncsutil/oldauth.h similarity index 100% rename from native/bncsutil/src/bncsutil/oldauth.h rename to bncsutil/src/bncsutil/oldauth.h diff --git a/native/bncsutil/src/bncsutil/pe.c b/bncsutil/src/bncsutil/pe.c similarity index 100% rename from native/bncsutil/src/bncsutil/pe.c rename to bncsutil/src/bncsutil/pe.c diff --git a/native/bncsutil/src/bncsutil/pe.h b/bncsutil/src/bncsutil/pe.h similarity index 100% rename from native/bncsutil/src/bncsutil/pe.h rename to bncsutil/src/bncsutil/pe.h diff --git a/native/bncsutil/src/bncsutil/sha1.c b/bncsutil/src/bncsutil/sha1.c similarity index 100% rename from native/bncsutil/src/bncsutil/sha1.c rename to bncsutil/src/bncsutil/sha1.c diff --git a/native/bncsutil/src/bncsutil/sha1.h b/bncsutil/src/bncsutil/sha1.h similarity index 100% rename from native/bncsutil/src/bncsutil/sha1.h rename to bncsutil/src/bncsutil/sha1.h diff --git a/native/bncsutil/src/bncsutil/stack.c b/bncsutil/src/bncsutil/stack.c similarity index 100% rename from native/bncsutil/src/bncsutil/stack.c rename to bncsutil/src/bncsutil/stack.c diff --git a/native/bncsutil/src/bncsutil/stack.h b/bncsutil/src/bncsutil/stack.h similarity index 100% rename from native/bncsutil/src/bncsutil/stack.h rename to bncsutil/src/bncsutil/stack.h diff --git a/native/bncsutil/vb6_example/.gitattributes b/bncsutil/vb6_example/.gitattributes similarity index 100% rename from native/bncsutil/vb6_example/.gitattributes rename to bncsutil/vb6_example/.gitattributes diff --git a/native/bncsutil/vb6_example/BNCSutil.bas b/bncsutil/vb6_example/BNCSutil.bas similarity index 100% rename from native/bncsutil/vb6_example/BNCSutil.bas rename to bncsutil/vb6_example/BNCSutil.bas diff --git a/native/bncsutil/vb6_example/BNCSutilExample.exe b/bncsutil/vb6_example/BNCSutilExample.exe similarity index 100% rename from native/bncsutil/vb6_example/BNCSutilExample.exe rename to bncsutil/vb6_example/BNCSutilExample.exe diff --git a/native/bncsutil/vb6_example/BNCSutilExample.vbp b/bncsutil/vb6_example/BNCSutilExample.vbp similarity index 100% rename from native/bncsutil/vb6_example/BNCSutilExample.vbp rename to bncsutil/vb6_example/BNCSutilExample.vbp diff --git a/native/bncsutil/vb6_example/BNCSutilExample.vbw b/bncsutil/vb6_example/BNCSutilExample.vbw similarity index 100% rename from native/bncsutil/vb6_example/BNCSutilExample.vbw rename to bncsutil/vb6_example/BNCSutilExample.vbw diff --git a/native/bncsutil/vb6_example/Connection.bas b/bncsutil/vb6_example/Connection.bas similarity index 100% rename from native/bncsutil/vb6_example/Connection.bas rename to bncsutil/vb6_example/Connection.bas diff --git a/native/bncsutil/vb6_example/Interface.bas b/bncsutil/vb6_example/Interface.bas similarity index 100% rename from native/bncsutil/vb6_example/Interface.bas rename to bncsutil/vb6_example/Interface.bas diff --git a/native/bncsutil/vb6_example/MSSCCPRJ.SCC b/bncsutil/vb6_example/MSSCCPRJ.SCC similarity index 100% rename from native/bncsutil/vb6_example/MSSCCPRJ.SCC rename to bncsutil/vb6_example/MSSCCPRJ.SCC diff --git a/native/bncsutil/vb6_example/NLS.cls b/bncsutil/vb6_example/NLS.cls similarity index 100% rename from native/bncsutil/vb6_example/NLS.cls rename to bncsutil/vb6_example/NLS.cls diff --git a/native/bncsutil/vb6_example/Packet.cls b/bncsutil/vb6_example/Packet.cls similarity index 100% rename from native/bncsutil/vb6_example/Packet.cls rename to bncsutil/vb6_example/Packet.cls diff --git a/native/bncsutil/vb6_example/frmMain.frm b/bncsutil/vb6_example/frmMain.frm similarity index 100% rename from native/bncsutil/vb6_example/frmMain.frm rename to bncsutil/vb6_example/frmMain.frm diff --git a/native/bncsutil/vb6_example/frmNewAccount.frm b/bncsutil/vb6_example/frmNewAccount.frm similarity index 100% rename from native/bncsutil/vb6_example/frmNewAccount.frm rename to bncsutil/vb6_example/frmNewAccount.frm diff --git a/native/bncsutil/vb6_example/frmNewAccount.frx b/bncsutil/vb6_example/frmNewAccount.frx similarity index 100% rename from native/bncsutil/vb6_example/frmNewAccount.frx rename to bncsutil/vb6_example/frmNewAccount.frx diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..aca34c3 --- /dev/null +++ b/build.rs @@ -0,0 +1,12 @@ +extern crate napi_build; +extern crate cmake; + +fn main() { + let dst = cmake::Config::new("bncsutil").build(); + + println!("cargo:rustc-link-search={}/build/", dst.display()); + + println!("cargo:rustc-link-lib=static=bncsutil_static"); + + napi_build::setup(); +} diff --git a/index.js b/index.js new file mode 100644 index 0000000..89a3a95 --- /dev/null +++ b/index.js @@ -0,0 +1,28 @@ +const { loadBinding } = require('@node-rs/helper') + +/** + * __dirname means load native addon from current dir + * 'bncsutil-node' is the name of native addon + * the second arguments was decided by `napi.name` field in `package.json` + * the third arguments was decided by `name` field in `package.json` + * `loadBinding` helper will load `bncsutil-node.[PLATFORM].node` from `__dirname` first + * If failed to load addon, it will fallback to load from `bncsutil-node-[PLATFORM]` + */ +const lib = loadBinding(__dirname, 'bncsutil-node', 'bncsutil-node') + +/** + * extracts number from file name "ver-IX86-1.mpq" + * @param {string} mpqName + * @returns {number} + */ +lib.extractMPQNumber = (mpqName) => { + if (!mpqName || !mpqName.length || mpqName.indexOf('.') === -1) { + return -1 + } + + const numPos = mpqName.indexOf('.') - 1; + + return parseInt(mpqName[numPos], 16) +}; + +module.exports = lib; diff --git a/lib/index.test.js b/index.test.js similarity index 56% rename from lib/index.test.js rename to index.test.js index 25ac44e..c9cac85 100644 --- a/lib/index.test.js +++ b/index.test.js @@ -1,67 +1,69 @@ const lib = require('./index'); +console.log(Object.keys(lib)); + describe('bncsutil', () => { test('version', () => { expect(lib.version()).toBe(10300) }); - test('version_string', () => { - expect(lib.version_string()).toBe('1.3.0') + test('versionString', () => { + expect(lib.versionString()).toBe('1.3.0') }); - test('get_exe_info', () => { - expect(lib.get_exe_info("./mock/war3.exe")).toMatchObject( { - exe_info: "war3.exe 12/09/16 06:05:09 515048", - exe_version: 18547117 + test('getExeInfo', () => { + expect(lib.getExeInfo("./mock/war3.exe")).toMatchObject( { + exeInfo: "war3.exe 12/09/16 06:05:09 515048", + exeVersion: 18547117 }) }); - test('extract_MPQ_number ver-IX86-1.mpq', () => { - expect(lib.extract_MPQ_number("ver-IX86-1.mpq")).toBe(1); + test('extractMPQNumber ver-IX86-1.mpq', () => { + expect(lib.extractMPQNumber("ver-IX86-1.mpq")).toBe(1); }); - test('extract_MPQ_number ver-IX86-3.mpq', () => { - expect(lib.extract_MPQ_number("ver-IX86-3.mpq")).toBe(3); + test('extractMPQNumber ver-IX86-3.mpq', () => { + expect(lib.extractMPQNumber("ver-IX86-3.mpq")).toBe(3); }); test('check_revision', () => { - expect(lib.check_revision( + expect(lib.checkRevision( "B=454282227 C=2370009462 A=2264812340 4 A=A^S B=B-C C=C-A A=A+B", ["./mock/war3.exe"], - lib.extract_MPQ_number("ver-IX86-1.mpq") + lib.extractMPQNumber("ver-IX86-1.mpq") )).toBe(3796461076) }); - test('check_revision_flat B=454282227 C=2370009462 A=2264812340 4 A=A^S B=B-C C=C-A A=A+B', () => { + test('checkRevisionFlat B=454282227 C=2370009462 A=2264812340 4 A=A^S B=B-C C=C-A A=A+B', () => { // { valueString: 'A=1239576727 C=1604096186 B=4198521212 4 A=A+S B=B-C C=C^A A=A+B', file1: 'war3.exe', file2: 'Storm.dll', file3: 'game.dll', mpqNumber: 1 } 1618231241 // { valueString: 'A=3845581634 B=880823580 C=1363937103 4 A=A-S B=B-C C=C-A A=A-B', file1: 'war3.exe', file2: 'Storm.dll', file3: 'game.dll', mpqNumber: 3 } 2863374408 // { valueString: 'B=454282227 C=2370009462 A=2264812340 4 A=A^S B=B-C C=C-A A=A+B', file1: 'war3.exe', file2: 'Storm.dll', file3: 'game.dll', mpqNumber: 1 } 1076278704 - expect(lib.check_revision_flat( + expect(lib.checkRevisionFlat( 'B=454282227 C=2370009462 A=2264812340 4 A=A^S B=B-C C=C-A A=A+B', "./mock/war3.exe", "./mock/Storm.dll", "./mock/game.dll", - lib.extract_MPQ_number("ver-IX86-1.mpq"), + lib.extractMPQNumber("ver-IX86-1.mpq"), )).toBe(1076278704); }); - test('check_revision_flat A=3845581634 B=880823580 C=1363937103 4 A=A-S B=B-C C=C-A A=A-B', () => { - expect(lib.check_revision_flat( + test('checkRevisionFlat A=3845581634 B=880823580 C=1363937103 4 A=A-S B=B-C C=C-A A=A-B', () => { + expect(lib.checkRevisionFlat( 'A=3845581634 B=880823580 C=1363937103 4 A=A-S B=B-C C=C-A A=A-B', "./mock/war3.exe", "./mock/Storm.dll", "./mock/game.dll", - lib.extract_MPQ_number("ver-IX86-3.mpq"), + lib.extractMPQNumber("ver-IX86-3.mpq"), )).toBe(2863374408); }); - test('check_revision_flat A=1239576727 C=1604096186 B=4198521212 4 A=A+S B=B-C C=C^A A=A+B', () => { - expect(lib.check_revision_flat( + test('checkRevisionFlat A=1239576727 C=1604096186 B=4198521212 4 A=A+S B=B-C C=C^A A=A+B', () => { + expect(lib.checkRevisionFlat( 'A=1239576727 C=1604096186 B=4198521212 4 A=A+S B=B-C C=C^A A=A+B', "./mock/1.28.5/war3.exe", "./mock/1.28.5/Storm.dll", "./mock/1.28.5/game.dll", - lib.extract_MPQ_number("ver-IX86-1.mpq"), + lib.extractMPQNumber("ver-IX86-1.mpq"), )).toBe(1618231241); }); }); diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 26f085b..0000000 --- a/lib/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// console.log(addon.create_client_public_key('jilizart', 'jilizart')); - -const lib = require('../native'); - -/** - * extracts number from file name "ver-IX86-1.mpq" - * @param {string} mpqName - * @returns {number} - */ -lib.extract_MPQ_number = (mpqName) => { - if (!mpqName || !mpqName.length || mpqName.indexOf('.') === -1) { - return -1 - } - - const numPos = mpqName.indexOf('.') - 1; - - return parseInt(mpqName[numPos], 16) -}; - -module.exports = lib; diff --git a/native/Cargo.lock b/native/Cargo.lock deleted file mode 100644 index e411ecc..0000000 --- a/native/Cargo.lock +++ /dev/null @@ -1,151 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - -[[package]] -name = "bncsutil-node" -version = "0.1.0" -dependencies = [ - "cmake", - "libc", - "neon", - "neon-build", -] - -[[package]] -name = "cc" -version = "1.0.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cmake" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb" -dependencies = [ - "cc", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "neon" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28e15415261d880aed48122e917a45e87bb82cf0260bb6db48bbab44b7464373" -dependencies = [ - "neon-build", - "neon-runtime", - "semver", - "smallvec", -] - -[[package]] -name = "neon-build" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bac98a702e71804af3dacfde41edde4a16076a7bbe889ae61e56e18c5b1c811" -dependencies = [ - "neon-sys", -] - -[[package]] -name = "neon-runtime" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4676720fa8bb32c64c3d9f49c47a47289239ec46b4bdb66d0913cc512cb0daca" -dependencies = [ - "cfg-if", - "neon-sys", - "smallvec", -] - -[[package]] -name = "neon-sys" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5ebc923308ac557184455b4aaa749470554cbac70eb4daa8b18cdc16bef7df6" -dependencies = [ - "cc", - "regex", -] - -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "smallvec" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" - -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] diff --git a/native/build.rs b/native/build.rs deleted file mode 100644 index f3c0ebe..0000000 --- a/native/build.rs +++ /dev/null @@ -1,12 +0,0 @@ -extern crate neon_build; -extern crate cmake; - -fn main() { - let dst = cmake::Config::new("bncsutil").build(); - - println!("cargo:rustc-link-search={}/build/", dst.display()); - - println!("cargo:rustc-link-lib=static=bncsutil_static"); - - neon_build::setup(); // must be called in build.rs -} diff --git a/native/src/lib.rs b/native/src/lib.rs deleted file mode 100644 index d1e6fbb..0000000 --- a/native/src/lib.rs +++ /dev/null @@ -1,114 +0,0 @@ -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -//#[macro_use] -extern crate neon; -extern crate libc; - -use bncs::*; -use std::path::Path; -use std::path::PathBuf; -use neon::prelude::*; - -mod bncs; - -//fn version(mut cx: FunctionContext) -> JsResult { -// unsafe { -// Ok(cx.number(bncsutil_getVersion() as f64)) -// } -//} -//include!("./bncsutil.rs"); - -//fn create_client_public_key(mut cx: FunctionContext) -> JsResult { -// let mut username = cx.argument::(0)?.value(); -// let mut password = cx.argument::(1)?.value(); -// let mut result: Vec = Vec::new(); -// let s = result.as_mut_ptr(); -// -// let c_u_b = CString::new(username).expect("username to CString"); -// let c_p_b = CString::new(password).expect("password to CString"); -// let mut c_u = CStr::from_bytes_with_nul(c_u_b.to_bytes_with_nul()).expect("try convert username to cstr"); -// let mut c_p = CStr::from_bytes_with_nul(c_p_b.to_bytes_with_nul()).expect("try convert password to cstr"); -// -// unsafe { -// nls_get_A(nls_init(c_u.as_ptr(), c_p.as_ptr()), s); -// } -// -// -// let buffer:Handle = cx.buffer(result.len() as u32)?; -// -// result.iter().enumerate().for_each(|e| { -// let (i, obj) = e; -// let js_number = cx.number(result[i]); -// let _ = buffer.set(&mut cx, i as u32, js_number); -// }); - -// Ok(buffer) - -//} - -fn version_js(mut cx: FunctionContext) -> JsResult { - Ok(cx.number(version() as f64)) -} - -fn version_string_js(mut cx: FunctionContext) -> JsResult { - Ok(cx.string(version_string())) -} - -fn get_exe_info_js(mut cx: FunctionContext) -> JsResult { - let path_string = cx.argument::(0)?.value(); - let path = PathBuf::from(path_string); - let (length, - exe_info, - exe_version) = get_exe_info(&path); - - let object = JsObject::new(&mut cx); - let js_info = cx.string(&exe_info); - let js_version = cx.number(exe_version as f64); - object.set(&mut cx, "exe_info", js_info).unwrap(); - object.set(&mut cx, "exe_version", js_version).unwrap(); - - Ok(object) -} -// value: String, files: Vec<&Path>, mpqNumber: i32 -fn check_revision_js(mut cx: FunctionContext) -> JsResult { - let value_string = cx.argument::(0)?.value(); - let files_arr_handle: Handle = cx.argument(1)?; - let files_vec: Vec> = files_arr_handle.to_vec(&mut cx)?; - let files = files_vec - .iter() - .map(|val| val.to_string(&mut cx).unwrap()) - .map(|val| val.value()) - .collect::>(); - - let files_ref = files.iter().map(|val| Path::new(val.as_str())).collect(); - - let mpq_number = cx.argument::(2)?.value(); - - Ok(cx.number(check_revision(value_string, files_ref, mpq_number as i32))) -} - -// value: String, file1: &Path, file2: &Path, file3: &Path, mpq_number: i32 -fn check_revision_flat_js(mut cx: FunctionContext) -> JsResult { - let value_string = cx.argument::(0)?.value(); - let file1= cx.argument::(1)?.value(); - let file2= cx.argument::(2)?.value(); - let file3= cx.argument::(3)?.value(); - let mpq_number = cx.argument::(4)?.value(); - - let files = vec![file1, file2, file3]; - let files_ref = files.iter().map(|val| Path::new(val.as_str())).collect(); - - Ok(cx.number(check_revision(value_string, files_ref, mpq_number as i32))) -} - -register_module!(mut m, { - m.export_function("version_string", version_string_js); - m.export_function("version", version_js); - m.export_function("get_exe_info", get_exe_info_js); - m.export_function("check_revision", check_revision_js); - m.export_function("check_revision_flat", check_revision_flat_js); - - Ok(()) -}); diff --git a/npm/android-arm64/README.md b/npm/android-arm64/README.md new file mode 100644 index 0000000..634f848 --- /dev/null +++ b/npm/android-arm64/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-android-arm64` + +This is the **aarch64-linux-android** binary for `bncsutil-node` diff --git a/npm/android-arm64/package.json b/npm/android-arm64/package.json new file mode 100644 index 0000000..0a5ae83 --- /dev/null +++ b/npm/android-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-android-arm64", + "version": "0.0.0", + "os": [ + "android" + ], + "cpu": [ + "arm64" + ], + "main": "bncsutil-node.android-arm64.node", + "files": [ + "bncsutil-node.android-arm64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/darwin-arm64/README.md b/npm/darwin-arm64/README.md new file mode 100644 index 0000000..066fc14 --- /dev/null +++ b/npm/darwin-arm64/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-darwin-arm64` + +This is the **aarch64-apple-darwin** binary for `bncsutil-node` diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json new file mode 100644 index 0000000..8e1d941 --- /dev/null +++ b/npm/darwin-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-darwin-arm64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "main": "bncsutil-node.darwin-arm64.node", + "files": [ + "bncsutil-node.darwin-arm64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/darwin-x64/README.md b/npm/darwin-x64/README.md new file mode 100644 index 0000000..a73283d --- /dev/null +++ b/npm/darwin-x64/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-darwin-x64` + +This is the **x86_64-apple-darwin** binary for `bncsutil-node` diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json new file mode 100644 index 0000000..e5a2549 --- /dev/null +++ b/npm/darwin-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-darwin-x64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "main": "bncsutil-node.darwin-x64.node", + "files": [ + "bncsutil-node.darwin-x64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/freebsd-x64/README.md b/npm/freebsd-x64/README.md new file mode 100644 index 0000000..3aec902 --- /dev/null +++ b/npm/freebsd-x64/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-freebsd-x64` + +This is the **x86_64-unknown-freebsd** binary for `bncsutil-node` diff --git a/npm/freebsd-x64/package.json b/npm/freebsd-x64/package.json new file mode 100644 index 0000000..1ab4805 --- /dev/null +++ b/npm/freebsd-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-freebsd-x64", + "version": "0.0.0", + "os": [ + "freebsd" + ], + "cpu": [ + "x64" + ], + "main": "bncsutil-node.freebsd-x64.node", + "files": [ + "bncsutil-node.freebsd-x64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/linux-arm64-gnu/README.md b/npm/linux-arm64-gnu/README.md new file mode 100644 index 0000000..628496f --- /dev/null +++ b/npm/linux-arm64-gnu/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-linux-arm64-gnu` + +This is the **aarch64-unknown-linux-gnu** binary for `bncsutil-node` diff --git a/npm/linux-arm64-gnu/package.json b/npm/linux-arm64-gnu/package.json new file mode 100644 index 0000000..369abbd --- /dev/null +++ b/npm/linux-arm64-gnu/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-linux-arm64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "main": "bncsutil-node.linux-arm64-gnu.node", + "files": [ + "bncsutil-node.linux-arm64-gnu.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/linux-x64-gnu/README.md b/npm/linux-x64-gnu/README.md new file mode 100644 index 0000000..3e50b05 --- /dev/null +++ b/npm/linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `bncsutil-node` diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json new file mode 100644 index 0000000..ac12678 --- /dev/null +++ b/npm/linux-x64-gnu/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-linux-x64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "bncsutil-node.linux-x64-gnu.node", + "files": [ + "bncsutil-node.linux-x64-gnu.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/win32-x64-msvc/README.md b/npm/win32-x64-msvc/README.md new file mode 100644 index 0000000..0682475 --- /dev/null +++ b/npm/win32-x64-msvc/README.md @@ -0,0 +1,3 @@ +# `bncsutil-node-win32-x64-msvc` + +This is the **x86_64-pc-windows-msvc** binary for `bncsutil-node` diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json new file mode 100644 index 0000000..18611d2 --- /dev/null +++ b/npm/win32-x64-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "bncsutil-node-win32-x64-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "main": "bncsutil-node.win32-x64-msvc.node", + "files": [ + "bncsutil-node.win32-x64-msvc.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fd6cb3c..8662268 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,22 @@ { - "name": "bncsutil", + "name": "bncsutil-node", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "bncsutil", + "name": "bncsutil-node", "version": "0.1.0", - "hasInstallScript": true, "license": "MIT", "dependencies": { - "neon-cli": "0.10.1" + "@node-rs/helper": "^1.2.1" }, "devDependencies": { + "@napi-rs/cli": "^1.2.1", "jest": "^26.4.2" + }, + "engines": { + "node": ">= 10" } }, "node_modules/@babel/code-frame": { @@ -731,6 +734,79 @@ "node": ">= 10.14.2" } }, + "node_modules/@napi-rs/cli": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-1.3.5.tgz", + "integrity": "sha512-Z0KZIciemioYODTyO908v2AtL8Zg4sohQDD+dyHeHmOiOfaez/y/xQ8XnpOHc2W5fRidKUW+MVWyTtpLTbKsqw==", + "dev": true, + "dependencies": { + "inquirer": "^8.1.3" + }, + "bin": { + "napi": "scripts/index.js" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/@napi-rs/cli/node_modules/inquirer": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz", + "integrity": "sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^6.0.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@napi-rs/cli/node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@napi-rs/cli/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/@napi-rs/triples": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@napi-rs/triples/-/triples-1.2.0.tgz", + "integrity": "sha512-HAPjR3bnCsdXBsATpDIP5WCrw0JcACwhhrwIAQhiR46n+jm+a2F8kBsfseAuWtSyQ+H3Yebt2k43B5dy+04yMA==" + }, + "node_modules/@node-rs/helper": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@node-rs/helper/-/helper-1.5.0.tgz", + "integrity": "sha512-4E1laLlg532nkrvUohZzl/wFos3bsHExSDw/guaoLekMcTKtD3ZsH6Vc4/qIRzOzAhQv5LLRnTE+vOeJ6C9Z8w==", + "dependencies": { + "@napi-rs/triples": "^1.2.0" + } + }, "node_modules/@sinonjs/commons": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", @@ -793,7 +869,8 @@ "node_modules/@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true }, "node_modules/@types/graceful-fs": { "version": "4.1.3", @@ -925,6 +1002,7 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, "dependencies": { "type-fest": "^0.11.0" }, @@ -939,6 +1017,7 @@ "version": "0.11.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true, "engines": { "node": ">=8" }, @@ -950,6 +1029,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, "engines": { "node": ">=8" } @@ -958,6 +1038,7 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, "dependencies": { "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" @@ -1018,14 +1099,6 @@ "node": ">=0.10.0" } }, - "node_modules/array-back": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", - "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", - "engines": { - "node": ">=6" - } - }, "node_modules/array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", @@ -1189,7 +1262,8 @@ "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "node_modules/base": { "version": "0.11.2", @@ -1261,6 +1335,26 @@ "node": ">=0.10.0" } }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -1270,10 +1364,22 @@ "tweetnacl": "^0.14.3" } }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "node_modules/brace-expansion": { "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" @@ -1306,17 +1412,36 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "node_modules/builtins": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", - "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=" - }, "node_modules/cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -1374,9 +1499,10 @@ "dev": true }, "node_modules/chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1400,7 +1526,8 @@ "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true }, "node_modules/ci-info": { "version": "2.0.0", @@ -1439,6 +1566,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, "dependencies": { "restore-cursor": "^3.1.0" }, @@ -1446,10 +1574,23 @@ "node": ">=8" } }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "dev": true, "engines": { "node": ">= 10" } @@ -1465,6 +1606,15 @@ "wrap-ansi": "^6.2.0" } }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -1498,6 +1648,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -1508,7 +1659,8 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/combined-stream": { "version": "1.0.8", @@ -1522,125 +1674,6 @@ "node": ">= 0.8" } }, - "node_modules/command-line-args": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", - "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", - "dependencies": { - "array-back": "^3.1.0", - "find-replace": "^3.0.0", - "lodash.camelcase": "^4.3.0", - "typical": "^4.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/command-line-commands": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/command-line-commands/-/command-line-commands-3.0.2.tgz", - "integrity": "sha512-ac6PdCtdR6q7S3HN+JiVLIWGHY30PRYIEl2qPo+FuEuzwAUk0UYyimrngrg7FvF/mCr4Jgoqv5ZnHZgads50rw==", - "dependencies": { - "array-back": "^4.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/command-line-commands/node_modules/array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/command-line-usage": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz", - "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==", - "dependencies": { - "array-back": "^4.0.2", - "chalk": "^2.4.2", - "table-layout": "^1.0.2", - "typical": "^5.2.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/command-line-usage/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/command-line-usage/node_modules/array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/command-line-usage/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/command-line-usage/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/command-line-usage/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/command-line-usage/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/command-line-usage/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/command-line-usage/node_modules/typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "engines": { - "node": ">=8" - } - }, "node_modules/component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -1650,7 +1683,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "node_modules/convert-source-map": { "version": "1.7.0", @@ -1776,14 +1810,6 @@ "node": ">=0.10" } }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -1799,6 +1825,18 @@ "node": ">=0.10.0" } }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/define-property": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", @@ -1926,7 +1964,8 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/end-of-stream": { "version": "1.4.4", @@ -1950,6 +1989,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, "engines": { "node": ">=0.8.0" } @@ -2149,6 +2189,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", @@ -2281,6 +2322,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -2303,17 +2345,6 @@ "node": ">=8" } }, - "node_modules/find-replace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", - "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", - "dependencies": { - "array-back": "^3.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -2374,7 +2405,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "node_modules/fsevents": { "version": "2.1.3", @@ -2448,18 +2480,11 @@ "assert-plus": "^1.0.0" } }, - "node_modules/git-config": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/git-config/-/git-config-0.0.7.tgz", - "integrity": "sha1-qcij7wendsPXImE1bYtye2IgKyg=", - "dependencies": { - "iniparser": "~1.0.5" - } - }, "node_modules/glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2497,26 +2522,6 @@ "dev": true, "optional": true }, - "node_modules/handlebars": { - "version": "4.7.6", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", - "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, "node_modules/har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2544,6 +2549,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -2663,6 +2669,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -2670,6 +2677,26 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/import-local": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", @@ -2699,6 +2726,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -2707,38 +2735,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/iniparser": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/iniparser/-/iniparser-1.0.5.tgz", - "integrity": "sha1-g21r7+bfv87gvM8c+fKsxwJ/eD0=", - "engines": { - "node": "*" - } - }, - "node_modules/inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "dependencies": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "engines": { - "node": ">=8.0.0" - } + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/ip-regex": { "version": "2.1.0", @@ -2875,6 +2873,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -2888,6 +2887,15 @@ "node": ">=6" } }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2930,6 +2938,18 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -3915,14 +3935,10 @@ } }, "node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" - }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lodash.sortby": { "version": "4.7.0", @@ -3930,15 +3946,20 @@ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, "dependencies": { - "yallist": "^4.0.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/make-dir": { @@ -3965,11 +3986,6 @@ "semver": "bin/semver.js" } }, - "node_modules/make-promises-safe": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/make-promises-safe/-/make-promises-safe-5.1.0.tgz", - "integrity": "sha512-AfdZ49rtyhQR/6cqVKGoH7y4ql7XkS5HJI1lZm0/5N6CQosy1eYbBJ/qbhkKHzo17UH7M918Bysf6XB9f3kS1g==" - }, "node_modules/makeerror": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", @@ -4044,6 +4060,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, "engines": { "node": ">=6" } @@ -4052,6 +4069,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -4062,7 +4080,8 @@ "node_modules/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true }, "node_modules/mixin-deep": { "version": "1.3.2", @@ -4098,7 +4117,8 @@ "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true }, "node_modules/nanomatch": { "version": "1.2.13", @@ -4128,52 +4148,6 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" - }, - "node_modules/neon-cli": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/neon-cli/-/neon-cli-0.10.1.tgz", - "integrity": "sha512-kOd9ELaYETe1J1nBEOYD7koAZVj6xR9TGwOPccAsWmwL5amkaXXXwXHCUHkBAWujlgSZY5f2pT+pFGkzoHExYQ==", - "dependencies": { - "chalk": "^4.1.0", - "command-line-args": "^5.1.1", - "command-line-commands": "^3.0.1", - "command-line-usage": "^6.1.0", - "git-config": "0.0.7", - "handlebars": "^4.7.6", - "inquirer": "^7.3.3", - "make-promises-safe": "^5.1.0", - "rimraf": "^3.0.2", - "semver": "^7.3.2", - "toml": "^3.0.0", - "ts-typed-json": "^0.3.2", - "validate-npm-package-license": "^3.0.4", - "validate-npm-package-name": "^3.0.0" - }, - "bin": { - "neon": "bin/cli.js" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/neon-cli/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -4353,6 +4327,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "dependencies": { "wrappy": "1" } @@ -4361,6 +4336,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, @@ -4388,10 +4364,34 @@ "node": ">= 0.8.0" } }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -4496,6 +4496,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -4684,12 +4685,18 @@ "node": ">=8" } }, - "node_modules/reduce-flatten": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", - "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, "engines": { - "node": ">=6" + "node": ">= 6" } }, "node_modules/regex-not": { @@ -4889,6 +4896,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -4910,6 +4918,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -4933,21 +4942,11 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, "engines": { "node": ">=0.12.0" } }, - "node_modules/rxjs": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", - "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", - "dependencies": { - "tslib": "^1.9.0" - }, - "engines": { - "npm": ">=2.0.0" - } - }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -4966,7 +4965,8 @@ "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true }, "node_modules/sane": { "version": "4.1.0", @@ -5220,7 +5220,8 @@ "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true }, "node_modules/sisteransi": { "version": "1.0.5", @@ -5398,6 +5399,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -5437,6 +5439,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -5445,12 +5448,14 @@ "node_modules/spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -5459,7 +5464,8 @@ "node_modules/spdx-license-ids": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", - "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true }, "node_modules/split-string": { "version": "3.1.0", @@ -5559,6 +5565,35 @@ "node": ">=0.10.0" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/string-length": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.1.tgz", @@ -5576,6 +5611,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -5589,6 +5625,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.0" }, @@ -5627,6 +5664,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -5653,36 +5691,6 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, - "node_modules/table-layout": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", - "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", - "dependencies": { - "array-back": "^4.0.1", - "deep-extend": "~0.6.0", - "typical": "^5.2.0", - "wordwrapjs": "^4.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/table-layout/node_modules/array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/table-layout/node_modules/typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "engines": { - "node": ">=8" - } - }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -5722,12 +5730,14 @@ "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, "dependencies": { "os-tmpdir": "~1.0.2" }, @@ -5801,11 +5811,6 @@ "node": ">=8.0" } }, - "node_modules/toml": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", - "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" - }, "node_modules/tough-cookie": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", @@ -5832,16 +5837,6 @@ "node": ">=8" } }, - "node_modules/ts-typed-json": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/ts-typed-json/-/ts-typed-json-0.3.2.tgz", - "integrity": "sha512-Tdu3BWzaer7R5RvBIJcg9r8HrTZgpJmsX+1meXMJzYypbkj8NK2oJN0yvm4Dp/Iv6tzFa/L5jKRmEVTga6K3nA==" - }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -5899,26 +5894,6 @@ "is-typedarray": "^1.0.0" } }, - "node_modules/typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/uglify-js": { - "version": "3.10.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.3.tgz", - "integrity": "sha512-Lh00i69Uf6G74mvYpHCI9KVVXLcHW/xu79YTvH7Mkc9zyKUeSPz0owW0dguj0Scavns3ZOh3wY63J0Zb97Za2g==", - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -6007,6 +5982,12 @@ "node": ">=0.10.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, "node_modules/uuid": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", @@ -6044,19 +6025,12 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, - "node_modules/validate-npm-package-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", - "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", - "dependencies": { - "builtins": "^1.0.3" - } - }, "node_modules/verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -6102,6 +6076,15 @@ "makeerror": "1.0.x" } }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, + "dependencies": { + "defaults": "^1.0.3" + } + }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", @@ -6167,31 +6150,6 @@ "node": ">=0.10.0" } }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" - }, - "node_modules/wordwrapjs": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", - "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", - "dependencies": { - "reduce-flatten": "^2.0.0", - "typical": "^5.2.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/wordwrapjs/node_modules/typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "engines": { - "node": ">=8" - } - }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -6209,7 +6167,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "node_modules/write-file-atomic": { "version": "3.0.3", @@ -6262,11 +6221,6 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", diff --git a/package.json b/package.json index bb466e1..531bdf4 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,37 @@ { - "name": "bncsutil", + "name": "bncsutil-node", "version": "0.1.0", "description": "BNCS bindings for Node", - "main": "lib/index.js", + "main": "index.js", "author": "Nikolay Kostyurin ", "license": "MIT", - "scripts": { - "install": "neon build", - "test": "npm run install && jest lib" + "napi": { + "name": "bncsutil-node", + "triples": { + "additional": [ + "aarch64-apple-darwin", + "aarch64-linux-android", + "aarch64-unknown-linux-gnu", + "x86_64-unknown-freebsd" + ] + } }, "dependencies": { - "neon-cli": "0.10.1" + "@node-rs/helper": "^1.2.1" }, "devDependencies": { + "@napi-rs/cli": "^1.2.1", "jest": "^26.4.2" + }, + "engines": { + "node": ">= 10" + }, + "scripts": { + "artifacts": "napi artifacts", + "build": "napi build --platform --release", + "build:debug": "napi build --platform", + "prepublishOnly": "napi prepublish -t npm", + "version": "napi version", + "test": "npm run build && jest ." } -} +} \ No newline at end of file diff --git a/native/src/bncs.rs b/src/bncs.rs similarity index 100% rename from native/src/bncs.rs rename to src/bncs.rs diff --git a/native/src/bncsutil.rs b/src/bncsutil.rs similarity index 100% rename from native/src/bncsutil.rs rename to src/bncsutil.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..ae93eee --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,130 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +#[macro_use] +extern crate napi_derive; +extern crate libc; + +use napi::*; +use std::path::Path; +use std::path::PathBuf; +use std::convert::TryInto; +use std::collections::HashMap; + +mod bncs; + +//fn version(mut cx: CallContext) -> Result { +// unsafe { +// Ok(cx.number(bncsutil_getVersion() as f64)) +// } +//} +//include!("./bncsutil.rs"); + +//fn create_client_public_key(mut cx: CallContext) -> Result { +// let mut username = cx.argument::(0)?.value(); +// let mut password = cx.argument::(1)?.value(); +// let mut result: Vec = Vec::new(); +// let s = result.as_mut_ptr(); +// +// let c_u_b = CString::new(username).expect("username to CString"); +// let c_p_b = CString::new(password).expect("password to CString"); +// let mut c_u = CStr::from_bytes_with_nul(c_u_b.to_bytes_with_nul()).expect("try convert username to cstr"); +// let mut c_p = CStr::from_bytes_with_nul(c_p_b.to_bytes_with_nul()).expect("try convert password to cstr"); +// +// unsafe { +// nls_get_A(nls_init(c_u.as_ptr(), c_p.as_ptr()), s); +// } +// +// +// let buffer:Handle = cx.buffer(result.len() as u32)?; +// +// result.iter().enumerate().for_each(|e| { +// let (i, obj) = e; +// let js_number = cx.number(result[i]); +// let _ = buffer.set(&mut cx, i as u32, js_number); +// }); + +// Ok(buffer) + +//} + +#[napi] +fn version() -> f64 { + bncs::version() as f64 +} + +#[napi] +fn version_string() -> String { + bncs::version_string() +} + +#[napi(object)] +pub struct ExeInfo { + pub exe_info: String, + pub exe_version: f64 +} + +#[napi] +fn get_exe_info(path_string: String) -> ExeInfo { + // let path_string = cx.get::(0)?.try_into()?; + let path = PathBuf::from(path_string); + let (_, exe_info, exe_version) = bncs::get_exe_info(&path); + + // let object = cx.env.create_object(); + // let js_info = cx.env.create_string(&exe_info); + // let js_version = cx.env.create_double(exe_version as f64); + + // object.set("exe_info", js_info).unwrap(); + // object.set("exe_version", js_version).unwrap(); + + ExeInfo { + exe_info, + exe_version: exe_version.into() + } +} + +// value: String, files: Vec<&Path>, mpqNumber: i32 +#[napi] +fn check_revision(value: String, files: Vec, mpq_number: i32) -> u32 { + // let value_string = cx.get::(0)?.try_into()?; + // let files_arr_handle: Handle = cx.get(1)?.try_into()?; + // let files_vec: Vec> = files_arr_handle.to_vec(&mut cx)?; + // let files = files_vec + // .iter() + // .map(|val| val.to_string(&mut cx).unwrap()) + // .map(|val| val.value()) + // .collect::>(); + + let files_ref = files.iter().map(|val| Path::new(val.as_str())).collect(); + + // let mpq_number = cx.get::(2)?.try_into()?; + + bncs::check_revision(value, files_ref, mpq_number as i32) +} + +// value: String, file1: &Path, file2: &Path, file3: &Path, mpq_number: i32 +#[napi] +fn check_revision_flat(value: String, file1: String, file2: String, file3: String, mpq_number: i32) -> u32 { + // let value_string = cx.get::(0)?.try_into()?; + // let file1= cx.get::(1)?.try_into()?; + // let file2= cx.get::(2)?.try_into()?; + // let file3= cx.get::(3)?.try_into()?; + // let mpq_number = cx.get::(4)?.try_into()?; + + let files = vec![file1, file2, file3]; + let files_ref = files.iter().map(|val| Path::new(val.as_str())).collect(); + + bncs::check_revision(value, files_ref, mpq_number as i32) +} + +// #[module_exports] +// fn init(mut m: JsObject) -> Result<()> { +// m.create_named_method("version_string", version_string_js); +// m.create_named_method("version", version_js); +// m.create_named_method("get_exe_info", get_exe_info_js); +// // m.create_named_method("check_revision", check_revision_js); +// // m.create_named_method("check_revision_flat", check_revision_flat_js); + +// Ok(()) +// } \ No newline at end of file