From ad7cdc07e1f40e2b663577312ed47b1b64e9eafc Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Fri, 25 Jun 2021 14:46:52 -0700 Subject: [PATCH] feat(test-tooling): rust compiler container for wasm builds Uses the stock rust container image from DockerHub Can do regular cargo builds and wasm-pack as well. This can be used to author test cases related to the API server being able to load WASM modules as Cactus plugins in the near future (this commit is part of the effort to build out the scaffolding of tests prior to getting the actual feature implemented) Signed-off-by: Peter Somogyvari --- packages/cactus-cockpit/package-lock.json | 446 ++++++------------ .../cactus-test-tooling/package-lock.json | 124 ++++- packages/cactus-test-tooling/package.json | 6 +- .../src/main/typescript/public-api.ts | 8 + .../rustc-container/rustc-build-cmd.ts | 16 + .../rustc-container/rustc-container.ts | 220 +++++++++ .../rust/fixtures/wasm-hello-world/.gitignore | 2 + .../rust/fixtures/wasm-hello-world/Cargo.lock | 144 ++++++ .../rust/fixtures/wasm-hello-world/Cargo.toml | 12 + .../rust/fixtures/wasm-hello-world/src/lib.rs | 16 + .../rustc-container-target-bundler.test.ts | 126 +++++ .../rustc-container-target-nodejs.test.ts | 124 +++++ tools/docker/rust-compiler/Dockerfile | 7 + tools/docker/rust-compiler/README.md | 17 + tools/docker/rust-compiler/hooks/post_push | 18 + 15 files changed, 979 insertions(+), 307 deletions(-) create mode 100644 packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-build-cmd.ts create mode 100644 packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts create mode 100644 packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/.gitignore create mode 100644 packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.lock create mode 100644 packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.toml create mode 100644 packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/src/lib.rs create mode 100644 packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts create mode 100644 packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-nodejs.test.ts create mode 100644 tools/docker/rust-compiler/Dockerfile create mode 100644 tools/docker/rust-compiler/README.md create mode 100755 tools/docker/rust-compiler/hooks/post_push diff --git a/packages/cactus-cockpit/package-lock.json b/packages/cactus-cockpit/package-lock.json index 81a6adcf82..9e647e96ac 100644 --- a/packages/cactus-cockpit/package-lock.json +++ b/packages/cactus-cockpit/package-lock.json @@ -19815,85 +19815,6 @@ } } }, - "@hyperledger/cactus-api-client": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@hyperledger/cactus-api-client/-/cactus-api-client-0.5.0.tgz", - "integrity": "sha512-ALrDtoGqNHZ6I/KOUWfrHTpZINlxBR/SFl7uG/pZNR/mWZqO1BBPKPseAyTr04r2uT3eYkLzozzzoFB5MMtZig==", - "requires": { - "@hyperledger/cactus-common": "0.5.0", - "@hyperledger/cactus-core": "0.5.0", - "@hyperledger/cactus-core-api": "0.5.0", - "@hyperledger/cactus-plugin-consortium-manual": "0.5.0" - } - }, - "@hyperledger/cactus-common": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@hyperledger/cactus-common/-/cactus-common-0.5.0.tgz", - "integrity": "sha512-FMWE+9UJUpiaiESbULfbF/Q7GG9CH3jVCl6pqJMU673tsryCL6U/IgYEiRFW4aOFr+g81McG2xiUZ31E52696g==", - "requires": { - "json-stable-stringify": "1.0.1", - "key-encoder": "2.0.3", - "loglevel": "1.6.7", - "loglevel-plugin-prefix": "0.8.4", - "secp256k1": "4.0.2", - "sha3": "2.1.3" - }, - "dependencies": { - "loglevel": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.7.tgz", - "integrity": "sha512-cY2eLFrQSAfVPhCgH1s7JI73tMbg9YC3v3+ZHVW67sBS7UxWzNEk/ZBbSfLykBWHp33dqqtOv82gjhKEi81T/A==" - } - } - }, - "@hyperledger/cactus-core": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@hyperledger/cactus-core/-/cactus-core-0.5.0.tgz", - "integrity": "sha512-putWKhR97P4NkddBlZuT/pyP8/1SkoJgXtWBAWxk2m/+DtAoHCqMqHuDaZdc1IOmdPv4ouk5jwrZ36FExYr5ZQ==", - "requires": { - "@hyperledger/cactus-common": "0.5.0", - "@hyperledger/cactus-core-api": "0.5.0", - "express": "4.17.1", - "express-jwt-authz": "2.4.1", - "typescript-optional": "2.0.1" - } - }, - "@hyperledger/cactus-core-api": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@hyperledger/cactus-core-api/-/cactus-core-api-0.5.0.tgz", - "integrity": "sha512-Ba3vFellXjRoVd25Zw4+CQEZxrKVmjEybfz6jNWcMNHOV/bFTxlgOKtIGUDxH3v3HF5WNuxGzYGK77mPeF0mEg==", - "requires": { - "@hyperledger/cactus-common": "0.5.0", - "axios": "0.21.1", - "express": "4.17.1", - "typescript-optional": "2.0.1" - } - }, - "@hyperledger/cactus-plugin-consortium-manual": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@hyperledger/cactus-plugin-consortium-manual/-/cactus-plugin-consortium-manual-0.5.0.tgz", - "integrity": "sha512-VajNKMN3Vgvf83fwSAQMQ17e420jJ/Y8mPG9xmdZj8WmTxHuX73H9PH7uQ0nQggFA7/vGFrrhqvBUl5XqLUNdA==", - "requires": { - "@hyperledger/cactus-common": "0.5.0", - "@hyperledger/cactus-core": "0.5.0", - "@hyperledger/cactus-core-api": "0.5.0", - "axios": "0.21.1", - "body-parser": "1.19.0", - "express": "4.17.1", - "jose": "1.27.2", - "json-stable-stringify": "1.0.1", - "prom-client": "13.0.0", - "typescript-optional": "2.0.1", - "uuid": "8.3.2" - }, - "dependencies": { - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - } - } - }, "@ionic-native/core": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-5.0.0.tgz", @@ -20111,11 +20032,6 @@ } } }, - "@panva/asn1.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@panva/asn1.js/-/asn1.js-1.0.0.tgz", - "integrity": "sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw==" - }, "@schematics/angular": { "version": "11.2.1", "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-11.2.1.tgz", @@ -20157,14 +20073,6 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, - "@types/bn.js": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", - "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", - "requires": { - "@types/node": "*" - } - }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -20176,14 +20084,6 @@ "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" }, - "@types/elliptic": { - "version": "6.4.12", - "resolved": "https://registry.npmjs.org/@types/elliptic/-/elliptic-6.4.12.tgz", - "integrity": "sha512-gP1KsqoouLJGH6IJa28x7PXb3cRqh83X8HCLezd2dF+XcAIMKYv53KV+9Zn6QA561E120uOqZBQ+Jy/cl+fviw==", - "requires": { - "@types/bn.js": "*" - } - }, "@types/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", @@ -20215,7 +20115,8 @@ "@types/node": { "version": "12.12.42", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.42.tgz", - "integrity": "sha512-R/9QdYFLL9dE9l5cWWzWIZByVGFd7lk7JVOJ7KD+E1SJ4gni7XJRLz9QTjyYQiHIqEAgku9VgxdLjMlhhUaAFg==" + "integrity": "sha512-R/9QdYFLL9dE9l5cWWzWIZByVGFd7lk7JVOJ7KD+E1SJ4gni7XJRLz9QTjyYQiHIqEAgku9VgxdLjMlhhUaAFg==", + "dev": true }, "@types/parse-json": { "version": "4.0.0", @@ -20469,6 +20370,7 @@ "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dev": true, "requires": { "mime-types": "~2.1.24", "negotiator": "0.6.2" @@ -20725,6 +20627,7 @@ "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dev": true, "requires": { "bn.js": "^4.0.0", "inherits": "^2.0.1", @@ -20735,7 +20638,8 @@ "bn.js": { "version": "4.11.9", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true } } }, @@ -20843,14 +20747,6 @@ "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "dev": true }, - "axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", - "requires": { - "follow-redirects": "^1.10.0" - } - }, "axobject-query": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz", @@ -20994,7 +20890,8 @@ "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true }, "base64id": { "version": "2.0.0", @@ -21029,11 +20926,6 @@ "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", "dev": true }, - "bintrees": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.1.tgz", - "integrity": "sha1-DmVcm5wkNeqraL9AJyJtK1WjRSQ=" - }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -21089,6 +20981,7 @@ "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "dev": true, "requires": { "bytes": "3.1.0", "content-type": "~1.0.4", @@ -21105,12 +20998,14 @@ "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "dev": true }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -21118,12 +21013,14 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "dev": true } } }, @@ -21169,7 +21066,8 @@ "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true }, "browserify-aes": { "version": "1.2.0", @@ -21264,42 +21162,16 @@ } }, "browserslist": { - "version": "4.16.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.6.tgz", - "integrity": "sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ==", + "version": "4.16.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.3.tgz", + "integrity": "sha512-vIyhWmIkULaq04Gt93txdh+j02yX/JzlyhLYbV3YQCn/zvES3JnY7TifHHvvr1w5hTDluNKMkV05cs4vy8Q7sw==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001219", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.723", + "caniuse-lite": "^1.0.30001181", + "colorette": "^1.2.1", + "electron-to-chromium": "^1.3.649", "escalade": "^3.1.1", - "node-releases": "^1.1.71" - }, - "dependencies": { - "caniuse-lite": { - "version": "1.0.30001230", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz", - "integrity": "sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ==", - "dev": true - }, - "colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", - "dev": true - }, - "electron-to-chromium": { - "version": "1.3.740", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.740.tgz", - "integrity": "sha512-Mi2m55JrX2BFbNZGKYR+2ItcGnR4O5HhrvgoRRyZQlaMGQULqDhoGkLWHzJoshSzi7k1PUofxcDbNhlFrDZNhg==", - "dev": true - }, - "node-releases": { - "version": "1.1.72", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.72.tgz", - "integrity": "sha512-LLUo+PpH3dU6XizX3iVoubUNheF/owjXCZZ5yACDxNnPtgFuludV1ZL3ayK1kVep42Rmm0+R9/Y60NQbZ2bifw==", - "dev": true - } + "node-releases": "^1.1.70" } }, "browserstack": { @@ -21952,6 +21824,7 @@ "version": "0.5.3", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "dev": true, "requires": { "safe-buffer": "5.1.2" } @@ -21959,7 +21832,8 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true }, "convert-source-map": { "version": "1.7.0", @@ -21973,12 +21847,14 @@ "cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", + "dev": true }, "cookie-signature": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true }, "copy-anything": { "version": "2.0.3", @@ -22904,7 +22780,8 @@ "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true }, "dependency-graph": { "version": "0.7.2", @@ -22925,7 +22802,8 @@ "destroy": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true }, "detect-node": { "version": "2.0.4", @@ -23078,12 +22956,20 @@ "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.671", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.671.tgz", + "integrity": "sha512-RTD97QkdrJKaKwRv9h/wGAaoR2lGxNXEcBXS31vjitgTPwTWAbLdS7cEsBK68eEQy7p6YyT8D5BxBEYHu2SuwQ==", + "dev": true }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dev": true, "requires": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -23097,7 +22983,8 @@ "bn.js": { "version": "4.11.9", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true } } }, @@ -23116,7 +23003,8 @@ "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true }, "encoding": { "version": "0.1.13", @@ -23373,7 +23261,8 @@ "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true }, "escape-string-regexp": { "version": "1.0.5", @@ -23429,7 +23318,8 @@ "etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true }, "eventemitter3": { "version": "4.0.7", @@ -23537,6 +23427,7 @@ "version": "4.17.1", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "dev": true, "requires": { "accepts": "~1.3.7", "array-flatten": "1.1.1", @@ -23573,12 +23464,14 @@ "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -23586,20 +23479,17 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true }, "qs": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "dev": true } } }, - "express-jwt-authz": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/express-jwt-authz/-/express-jwt-authz-2.4.1.tgz", - "integrity": "sha512-ruH86e2NvWicG9maStztyAyBJV0E8RsInXUm6Kuc/9pDtVJmJw3qigv1MEVs5bH+aksZuxocYZdz+N1V/9F+Dg==" - }, "ext": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", @@ -23839,6 +23729,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dev": true, "requires": { "debug": "2.6.9", "encodeurl": "~1.0.2", @@ -23853,6 +23744,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" } @@ -23860,7 +23752,8 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true } } }, @@ -23929,7 +23822,8 @@ "follow-redirects": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", - "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==" + "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==", + "dev": true }, "for-in": { "version": "1.0.2", @@ -23957,7 +23851,8 @@ "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "dev": true }, "fraction.js": { "version": "4.0.13", @@ -23977,7 +23872,8 @@ "fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true }, "from2": { "version": "2.3.0", @@ -24349,6 +24245,7 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, "requires": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -24364,6 +24261,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, "requires": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -24437,6 +24335,7 @@ "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "dev": true, "requires": { "depd": "~1.1.2", "inherits": "2.0.3", @@ -24448,7 +24347,8 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true } } }, @@ -24659,6 +24559,7 @@ "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -24672,7 +24573,8 @@ "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true }, "iferr": { "version": "0.1.5", @@ -24819,7 +24721,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ini": { "version": "1.3.5", @@ -24953,7 +24856,8 @@ "ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true }, "is-absolute-url": { "version": "2.1.0", @@ -25467,14 +25371,6 @@ } } }, - "jose": { - "version": "1.27.2", - "resolved": "https://registry.npmjs.org/jose/-/jose-1.27.2.tgz", - "integrity": "sha512-zLIwnMa8dh5A2jFo56KvhiXCaW0hFjdNvG0I5GScL8Wro+/r/SnyIYTbnX3fYztPNSfgQp56sDMHUuS9c3e6bw==", - "requires": { - "@panva/asn1.js": "^1.0.0" - } - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -25527,14 +25423,6 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "~0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -25571,11 +25459,6 @@ "graceful-fs": "^4.1.6" } }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -25864,24 +25747,6 @@ "source-map-support": "^0.5.5" } }, - "key-encoder": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/key-encoder/-/key-encoder-2.0.3.tgz", - "integrity": "sha512-fgBtpAGIr/Fy5/+ZLQZIPPhsZEcbSlYu/Wu96tNDFNSjSACw5lEIOFeaVdQ/iwrb8oxjlWi6wmWdH76hV6GZjg==", - "requires": { - "@types/elliptic": "^6.4.9", - "asn1.js": "^5.0.1", - "bn.js": "^4.11.8", - "elliptic": "^6.4.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -26129,11 +25994,6 @@ "integrity": "sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==", "dev": true }, - "loglevel-plugin-prefix": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", - "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==" - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -26259,7 +26119,8 @@ "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true }, "memory-fs": { "version": "0.4.1", @@ -26274,7 +26135,8 @@ "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true }, "merge-source-map": { "version": "1.1.0", @@ -26308,7 +26170,8 @@ "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true }, "micromatch": { "version": "4.0.2", @@ -26341,17 +26204,20 @@ "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true }, "mime-db": { "version": "1.44.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true }, "mime-types": { "version": "2.1.27", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, "requires": { "mime-db": "1.44.0" } @@ -26417,12 +26283,14 @@ "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true }, "minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true }, "minimatch": { "version": "3.0.4", @@ -26669,7 +26537,8 @@ "negotiator": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "dev": true }, "neo-async": { "version": "2.6.2", @@ -26689,11 +26558,6 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" - }, "node-forge": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", @@ -26729,11 +26593,6 @@ } } }, - "node-gyp-build": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", - "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==" - }, "node-libs-browser": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", @@ -26784,6 +26643,12 @@ } } }, + "node-releases": { + "version": "1.1.70", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.70.tgz", + "integrity": "sha512-Slf2s69+2/uAD79pVVQo8uSiC34+g8GWY8UH2Qtqv34ZfhYrxpYpfzs9Js9d6O0mbDmALuxaTlplnBTnSELcrw==", + "dev": true + }, "nopt": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", @@ -27049,6 +26914,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, "requires": { "ee-first": "1.1.1" } @@ -27413,7 +27279,8 @@ "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true }, "pascalcase": { "version": "0.1.1", @@ -27466,7 +27333,8 @@ "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true }, "path-type": { "version": "4.0.0", @@ -28927,14 +28795,6 @@ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, - "prom-client": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-13.0.0.tgz", - "integrity": "sha512-M7ZNjIO6x+2R/vjSD13yjJPjpoZA8eEwH2Bp2Re0/PvzozD7azikv+SaBtZes4Q1ca/xHjZ4RSCuTag3YZLg1A==", - "requires": { - "tdigest": "^0.1.1" - } - }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -29277,6 +29137,7 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "dev": true, "requires": { "forwarded": "~0.1.2", "ipaddr.js": "1.9.1" @@ -29425,12 +29286,14 @@ "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true }, "raw-body": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "dev": true, "requires": { "bytes": "3.1.0", "http-errors": "1.7.2", @@ -29441,7 +29304,8 @@ "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "dev": true } } }, @@ -29969,7 +29833,8 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true }, "safe-regex": { "version": "1.1.0", @@ -29983,7 +29848,8 @@ "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 }, "sass": { "version": "1.32.6", @@ -30072,16 +29938,6 @@ } } }, - "secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", - "requires": { - "elliptic": "^6.5.2", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - } - }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -30176,6 +30032,7 @@ "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "dev": true, "requires": { "debug": "2.6.9", "depd": "~1.1.2", @@ -30196,6 +30053,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "requires": { "ms": "2.0.0" }, @@ -30203,14 +30061,16 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true } } }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true } } }, @@ -30283,6 +30143,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "dev": true, "requires": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", @@ -30334,7 +30195,8 @@ "setprototypeof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "dev": true }, "sha.js": { "version": "2.4.11", @@ -30346,25 +30208,6 @@ "safe-buffer": "^5.0.1" } }, - "sha3": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-2.1.3.tgz", - "integrity": "sha512-Io53D4o9qOmf3Ow9p/DoGLQiQHhtuR0ulbyambvRSG+OX5yXExk2yYfvjHtb7AtOyk6K6+sPeK/qaowWc/E/GA==", - "requires": { - "buffer": "5.6.0" - }, - "dependencies": { - "buffer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", - "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - } - } - }, "shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", @@ -31008,7 +30851,8 @@ "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true }, "stream-browserify": { "version": "2.0.2", @@ -31383,14 +31227,6 @@ } } }, - "tdigest": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.1.tgz", - "integrity": "sha1-Ljyyw56kSeVdHmzZEReszKRYgCE=", - "requires": { - "bintrees": "1.0.1" - } - }, "terser": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/terser/-/terser-5.5.1.tgz", @@ -31574,7 +31410,8 @@ "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "dev": true }, "tough-cookie": { "version": "2.5.0", @@ -31684,6 +31521,7 @@ "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, "requires": { "media-typer": "0.3.0", "mime-types": "~2.1.24" @@ -31701,11 +31539,6 @@ "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", "dev": true }, - "typescript-optional": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/typescript-optional/-/typescript-optional-2.0.1.tgz", - "integrity": "sha512-xuwmqsCjE4OeeMKxbNX3jjNcISGzYh5Q9R1rM5OyxEVNIr94CB5llCkfKW+1nZTKbbUV0axN3QAUuX2fus/DhQ==" - }, "ua-parser-js": { "version": "0.7.21", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", @@ -31802,7 +31635,8 @@ "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true }, "unquote": { "version": "1.1.1", @@ -31964,7 +31798,8 @@ "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true }, "uuid": { "version": "3.4.0", @@ -31984,7 +31819,8 @@ "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true }, "vendors": { "version": "1.0.4", diff --git a/packages/cactus-test-tooling/package-lock.json b/packages/cactus-test-tooling/package-lock.json index 2a47a952bf..71b40de6ce 100644 --- a/packages/cactus-test-tooling/package-lock.json +++ b/packages/cactus-test-tooling/package-lock.json @@ -29,12 +29,16 @@ }, "devDependencies": { "@types/dockerode": "2.5.28", + "@types/esm": "3.2.0", "@types/fs-extra": "8.1.0", "@types/joi": "14.3.4", "@types/node-ssh": "7.0.0", "@types/ssh2": "0.5.46", "@types/ssh2-streams": "0.1.8", - "@types/tar-stream": "2.1.0" + "@types/tar-stream": "2.1.0", + "@types/temp": "0.9.0", + "esm": "3.2.25", + "temp": "0.9.4" }, "engines": { "node": ">=10", @@ -201,6 +205,15 @@ "@types/node": "*" } }, + "node_modules/@types/esm": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@types/esm/-/esm-3.2.0.tgz", + "integrity": "sha512-aXemgVPnF1s0PQin04Ei8zTWaNwUdc4pmhZDg8LBW6QEl9kBWVItAUOLGUY5H5xduAmbL1pLGH1X/PN0+4R9tg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.0.tgz", @@ -286,6 +299,15 @@ "@types/node": "*" } }, + "node_modules/@types/temp": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@types/temp/-/temp-0.9.0.tgz", + "integrity": "sha512-UPoFCczcfwFjlopS9hDP6QR3oqng1YnRyKQSDNNFRAUurRaxV8FIjRbvT7Q2Co2zpXh23CEPEx1pKuITHnFQIA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@web3-js/scrypt-shim": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@web3-js/scrypt-shim/-/scrypt-shim-0.1.0.tgz", @@ -1420,6 +1442,15 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -4519,6 +4550,43 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/temp": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz", + "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==", + "dev": true, + "dependencies": { + "mkdirp": "^0.5.1", + "rimraf": "~2.6.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/temp/node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/temp/node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, "node_modules/timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", @@ -6557,6 +6625,15 @@ "@types/node": "*" } }, + "@types/esm": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@types/esm/-/esm-3.2.0.tgz", + "integrity": "sha512-aXemgVPnF1s0PQin04Ei8zTWaNwUdc4pmhZDg8LBW6QEl9kBWVItAUOLGUY5H5xduAmbL1pLGH1X/PN0+4R9tg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.0.tgz", @@ -6642,6 +6719,15 @@ "@types/node": "*" } }, + "@types/temp": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@types/temp/-/temp-0.9.0.tgz", + "integrity": "sha512-UPoFCczcfwFjlopS9hDP6QR3oqng1YnRyKQSDNNFRAUurRaxV8FIjRbvT7Q2Co2zpXh23CEPEx1pKuITHnFQIA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@web3-js/scrypt-shim": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@web3-js/scrypt-shim/-/scrypt-shim-0.1.0.tgz", @@ -7642,6 +7728,12 @@ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" }, + "esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "dev": true + }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -10245,6 +10337,36 @@ "readable-stream": "^3.1.1" } }, + "temp": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.9.4.tgz", + "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1", + "rimraf": "~2.6.2" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", diff --git a/packages/cactus-test-tooling/package.json b/packages/cactus-test-tooling/package.json index c7cf8d92f2..9ece86bd3e 100644 --- a/packages/cactus-test-tooling/package.json +++ b/packages/cactus-test-tooling/package.json @@ -102,11 +102,15 @@ }, "devDependencies": { "@types/dockerode": "2.5.28", + "@types/esm": "3.2.0", "@types/fs-extra": "8.1.0", "@types/joi": "14.3.4", "@types/node-ssh": "7.0.0", "@types/ssh2": "0.5.46", "@types/ssh2-streams": "0.1.8", - "@types/tar-stream": "2.1.0" + "@types/tar-stream": "2.1.0", + "@types/temp": "0.9.0", + "esm": "3.2.25", + "temp": "0.9.4" } } diff --git a/packages/cactus-test-tooling/src/main/typescript/public-api.ts b/packages/cactus-test-tooling/src/main/typescript/public-api.ts index 80a7a2cd06..38f8334a6d 100755 --- a/packages/cactus-test-tooling/src/main/typescript/public-api.ts +++ b/packages/cactus-test-tooling/src/main/typescript/public-api.ts @@ -98,6 +98,14 @@ export { SampleCordappEnum, } from "./corda/sample-cordapp-enum"; +export { + IRustcContainerOptions, + K_DEFAULT_RUSTC_CONTAINER_CMD, + RustcContainer, +} from "./rustc-container/rustc-container"; + +export { RustcBuildCmd } from "./rustc-container/rustc-build-cmd"; + export { Streams } from "./common/streams"; export { isRunningInGithubAction } from "./github-actions/is-running-in-github-action"; diff --git a/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-build-cmd.ts b/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-build-cmd.ts new file mode 100644 index 0000000000..9639903861 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-build-cmd.ts @@ -0,0 +1,16 @@ +export const RustcBuildCmd = { + CARGO_BUILD_RELEASE: ["cargo", "build", "--release"], + WASM_PACK_BUILD_BUNDLER: [ + "wasm-pack", + "build", + "--release", + "--target=bundler", + ], + WASM_PACK_BUILD_NODEJS: [ + "wasm-pack", + "build", + "--release", + "--target=nodejs", + ], + WASM_PACK_BUILD_WEB: ["wasm-pack", "build", "--release", "--target=web"], +}; diff --git a/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts b/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts new file mode 100644 index 0000000000..63604bfca4 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/rustc-container/rustc-container.ts @@ -0,0 +1,220 @@ +import type { EventEmitter } from "events"; +import fs from "fs-extra"; +import { Optional } from "typescript-optional"; +import { RuntimeError } from "run-time-error"; +import type { Container } from "dockerode"; +import Docker from "dockerode"; +import { Logger, Checks, Bools } from "@hyperledger/cactus-common"; +import type { LogLevelDesc } from "@hyperledger/cactus-common"; +import { LoggerProvider } from "@hyperledger/cactus-common"; +import { Containers } from "../common/containers"; +import { RustcBuildCmd } from "./rustc-build-cmd"; + +export const K_DEFAULT_RUSTC_CONTAINER_WORKDIR = "/usr/src/host-sources-dir/"; + +export const K_DEFAULT_RUSTC_CONTAINER_CMD = + RustcBuildCmd.WASM_PACK_BUILD_BUNDLER; + +export interface IRustcContainerOptions { + readonly logLevel?: LogLevelDesc; + readonly imageName?: string; + readonly imageTag?: string; + /** + * The path on the host machine's file-system where the carbo build should + * occur. Note that host machine in this context means the machine that runs + * the test using this class, the one launching the containers. + */ + readonly hostSourceDir?: string; + readonly emitContainerLogs?: boolean; + readonly envVars?: Map; + readonly workDir?: string; +} + +/** + * Helper class designed to enable test cases compiling Rust code without needing + * to depend on Rust being installed. + * + * At it's core, it is meant to be a programamatic substitute for doing something + * like this on your local machine: + * + * ```sh + * $ docker run --rm --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp rust:1.52.0 cargo build --release + * ``` + * + * @see https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm + */ +export class RustcContainer { + public static readonly CLASS_NAME = "RustcContainer"; + + public readonly logLevel: LogLevelDesc; + public readonly imageName: string; + public readonly imageTag: string; + public readonly imageFqn: string; + public readonly log: Logger; + public readonly emitContainerLogs: boolean; + public readonly hostSourceDir: Optional; + public readonly workDir: string; + public readonly envVars: Map; + + private _containerId: Optional; + + public get containerId(): Optional { + return this._containerId; + } + + public get cwd(): string { + return this.workDir; + } + + public get container(): Optional { + const docker = new Docker(); + return this.containerId.isPresent() + ? Optional.ofNonNull(docker.getContainer(this.containerId.get())) + : Optional.empty(); + } + + public get className(): string { + return RustcContainer.CLASS_NAME; + } + + constructor(public readonly opts: IRustcContainerOptions) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(opts, `${fnTag} arg options`); + + if (opts.hostSourceDir) { + Checks.nonBlankString(opts.hostSourceDir, `${fnTag} opts.hostSourceDir`); + } + + this._containerId = Optional.empty(); + this.hostSourceDir = Optional.ofNullable(opts.hostSourceDir); + this.imageName = + opts.imageName || "ghcr.io/hyperledger/cactus-rust-compiler"; + this.imageTag = opts.imageTag || "1.0.3"; + this.imageFqn = `${this.imageName}:${this.imageTag}`; + this.envVars = opts.envVars || new Map(); + this.emitContainerLogs = Bools.isBooleanStrict(opts.emitContainerLogs) + ? (opts.emitContainerLogs as boolean) + : true; + + this.workDir = opts.workDir + ? opts.workDir + : K_DEFAULT_RUSTC_CONTAINER_WORKDIR; + + Checks.nonBlankString(this.workDir, `${fnTag} non-blank str this.workDir`); + + this.logLevel = opts.logLevel || "INFO"; + + const level = this.logLevel; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level, label }); + + this.log.debug(`Created instance of ${this.className} OK`); + } + + public async start(omitPull = false): Promise { + if (this.hostSourceDir.isPresent()) { + await this.checkHostSourceDirExists(); + } + + const docker = new Docker(); + if (this.containerId.isPresent()) { + this.log.warn(`Container ID provided. Will not start new one.`); + const container = docker.getContainer(this.containerId.get()); + return container; + } + if (!omitPull) { + this.log.debug(`Pulling image ${this.imageFqn}...`); + await Containers.pullImage(this.imageFqn); + this.log.debug(`Pulled image ${this.imageFqn} OK`); + } + + const dockerEnvVars: string[] = new Array(...this.envVars).map( + (pairs) => `${pairs[0]}=${pairs[1]}`, + ); + + const Binds = this.hostSourceDir.isPresent() + ? [`${this.hostSourceDir.get()}:${this.cwd}`] + : []; + + const createOptions = { + WorkingDir: this.workDir, + Env: dockerEnvVars, + Healthcheck: { + Test: [ + "CMD-SHELL", + `rustup --version && rustc --version && cargo --version`, + ], + Interval: 1000000000, // 1 second + Timeout: 3000000000, // 3 seconds + Retries: 10, + StartPeriod: 1000000000, // 1 second + }, + HostConfig: { + AutoRemove: true, + Binds, + }, + }; + + this.log.debug(`Starting ${this.imageFqn} with options: `, createOptions); + + return new Promise((resolve, reject) => { + const eventEmitter: EventEmitter = docker.run( + this.imageFqn, + [], + [], + createOptions, + {}, + (err: Error) => { + if (err) { + const errorMessage = `Failed to start container ${this.imageFqn}`; + const exception = new RuntimeError(errorMessage, err); + this.log.error(exception); + reject(exception); + } + }, + ); + + eventEmitter.once("start", async (container: Container) => { + const { id } = container; + this.log.debug(`Started ${this.imageFqn} successfully. ID=${id}`); + this._containerId = Optional.ofNonNull(id); + + if (this.emitContainerLogs) { + const logOptions = { follow: true, stderr: true, stdout: true }; + const logStream = await container.logs(logOptions); + logStream.on("data", (data: Buffer) => { + const fnTag = `[${this.imageFqn}]`; + this.log.debug(`${fnTag} %o`, data.toString("utf-8")); + }); + } + this.log.debug(`Registered container log stream callbacks OK`); + + try { + this.log.debug(`Starting to wait for healthcheck... `); + await Containers.waitForHealthCheck(this.containerId.get()); + this.log.debug(`Healthcheck passed OK`); + resolve(container); + } catch (ex) { + this.log.error(ex); + reject(ex); + } + }); + }); + } + + public async stop(): Promise { + return Containers.stop(this.container.get()); + } + + public async destroy(): Promise { + return this.container.get().remove(); + } + + public async checkHostSourceDirExists(): Promise { + const pathExists = await fs.pathExists(this.hostSourceDir.get()); + if (!pathExists) { + const errorMessage = `hostSourceDir ${this.hostSourceDir.get()} does not exist (or not accessible) on file-system. Cannot continue with Rust compilation`; + throw new RuntimeError(errorMessage); + } + } +} diff --git a/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/.gitignore b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/.gitignore new file mode 100644 index 0000000000..ebf1dde788 --- /dev/null +++ b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/.gitignore @@ -0,0 +1,2 @@ +pkg/ +target/ diff --git a/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.lock b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.lock new file mode 100644 index 0000000000..c777d5bf06 --- /dev/null +++ b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.lock @@ -0,0 +1,144 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "bumpalo" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "hello-world" +version = "1.0.0" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "js-sys" +version = "0.3.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "proc-macro2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "wasm-bindgen" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" + +[[package]] +name = "web-sys" +version = "0.3.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" +dependencies = [ + "js-sys", + "wasm-bindgen", +] diff --git a/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.toml b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.toml new file mode 100644 index 0000000000..4949966c85 --- /dev/null +++ b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "hello-world" +version = "1.0.0" +authors = ["Hyperledger Cactus Contributors"] +edition = "2018" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2.68" +web-sys = {version = "0.3.45", features = ["console"]} diff --git a/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/src/lib.rs b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/src/lib.rs new file mode 100644 index 0000000000..8a5a434322 --- /dev/null +++ b/packages/cactus-test-tooling/src/test/rust/fixtures/wasm-hello-world/src/lib.rs @@ -0,0 +1,16 @@ +use wasm_bindgen::prelude::*; +use web_sys::console; + +#[wasm_bindgen] +pub fn hello_world() -> String { + let message = "Hello World!"; + console::log_1(&JsValue::from_str(message)); + return message.to_string(); +} + +#[wasm_bindgen] +pub fn say_hello(name: &str) -> String { + let greeting = format!("Hello {}!", name); + console::log_1(&JsValue::from_str(&*greeting)); + return greeting; +} \ No newline at end of file diff --git a/packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts b/packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts new file mode 100644 index 0000000000..8d6ac82271 --- /dev/null +++ b/packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-bundler.test.ts @@ -0,0 +1,126 @@ +import path from "path"; +import test, { Test } from "tape-promise/tape"; +import temp from "temp"; +import esm from "esm"; +import fs from "fs-extra"; +import { LogLevelDesc } from "../../../../../../cactus-common/dist/types/main/typescript"; +import { + Containers, + RustcBuildCmd, + RustcContainer, +} from "../../../../main/typescript/public-api"; + +const logLevel: LogLevelDesc = "TRACE"; + +type HelloWorldExports = { + hello_world: () => string; + say_hello: (name: string) => string; +}; + +test("compiles Rust code to bundler targeted .wasm", async (t: Test) => { + const tmpDirAffix = "cactus-test-tooling-rustc-container-test"; + temp.track(); + test.onFinish(async () => await temp.cleanup()); + const hostSourceDir = await temp.mkdir(tmpDirAffix); + + const srcDir = path.join(hostSourceDir, "./src/"); + await fs.mkdir(srcDir); + + const rustcContainer = new RustcContainer({ logLevel }); + t.ok(rustcContainer, "RustcContainer instance truthy OK"); + + test.onFinish(async () => { + await rustcContainer.stop(); + }); + + const dockerodeContainer = await rustcContainer.start(); + t.ok(dockerodeContainer, "dockerodeContainer truthy OK"); + + const containerPkDir = path.join(rustcContainer.cwd, "./pkg/"); + + const cargoTomlHostDir = path.join( + __dirname, + "../../../rust/fixtures/wasm-hello-world/", + ); + const putCargoTomlRes = await Containers.putFile({ + containerOrId: dockerodeContainer, + dstFileDir: rustcContainer.cwd, + dstFileName: "Cargo.toml", + srcFileDir: cargoTomlHostDir, + srcFileName: "Cargo.toml", + }); + t.ok(putCargoTomlRes, "putCargoTomlRes truthy OK"); + t.ok(putCargoTomlRes.statusCode, "putCargoTomlRes.statusCode truthy OK"); + t.equal(putCargoTomlRes.statusCode, 200, "putCargoTomlRes.statusCode 200 OK"); + + const containerSrcDir = path.join(rustcContainer.cwd, "./src/"); + await Containers.exec(dockerodeContainer, ["mkdir", containerSrcDir]); + + const libRsHostDir = path.join( + __dirname, + "../../../rust/fixtures/wasm-hello-world/src/", + ); + const putLibRsRes = await Containers.putFile({ + containerOrId: dockerodeContainer, + dstFileDir: containerSrcDir, + dstFileName: "lib.rs", + srcFileDir: libRsHostDir, + srcFileName: "lib.rs", + }); + t.ok(putLibRsRes, "putLibRsRes truthy OK"); + t.ok(putLibRsRes.statusCode, "putLibRsRes.statusCode truthy OK"); + t.equal(putLibRsRes.statusCode, 200, "putLibRsRes.statusCode 200 OK"); + + const wasmPackBuildOut = await Containers.exec( + dockerodeContainer, + RustcBuildCmd.WASM_PACK_BUILD_BUNDLER, + ); + t.ok(wasmPackBuildOut, "wasmPackBuildOut truthy OK"); + + // The list of files the wasm-pack bundler target produces + const expectedFiles = [ + ".gitignore", + "hello_world.d.ts", + "hello_world.js", + "hello_world_bg.js", + "hello_world_bg.wasm", + "hello_world_bg.wasm.d.ts", + "package.json", + ]; + + const filesOnFs = await Containers.ls(dockerodeContainer, containerPkDir); + t.ok(filesOnFs, "filesOnFs truthy OK"); + t.true(Array.isArray(filesOnFs), "Array.isArray(filesOnFs) OK"); + t.comment(`filesOnFs: ${JSON.stringify(filesOnFs)}`); + t.deepEqual(filesOnFs, expectedFiles, "deepEqual filesOnFs, fileNames OK"); + + const fileChecks = filesOnFs.map(async (fileName) => { + const containerFilePath = path.join(containerPkDir, fileName); + const hostFilePath = path.join(hostSourceDir, fileName); + const contentsBuffer = await Containers.pullBinaryFile( + dockerodeContainer, + containerFilePath, + ); + t.ok(contentsBuffer, `contents buffer truthy OK: ${containerFilePath}`); + t.true(contentsBuffer.length > 0, `size > 0 OK: ${containerFilePath}`); + await fs.writeFile(hostFilePath, contentsBuffer); + const { isFile, size } = await fs.stat(hostFilePath); + t.true(isFile, `isFile===true OK: ${hostFilePath}`); + t.true(size > 0, `size > 0 OK: ${hostFilePath}`); + }); + + await t.doesNotReject(Promise.all(fileChecks), "All WASM build files OK"); + + const wasmHostPath = path.join(hostSourceDir, "./hello_world.js"); + const esmRequire = esm(module, { wasm: true }); + const wasmModule = esmRequire(wasmHostPath) as HelloWorldExports; + const helloWorldOut = wasmModule.hello_world(); + t.ok(helloWorldOut, "helloWorldOut truthy OK"); + t.equal(helloWorldOut, "Hello World!", "helloWorldOut EQ Hello World! OK"); + + const greeting = wasmModule.say_hello("Peter"); + t.ok(greeting, "greeting truthy OK"); + t.equal(greeting, "Hello Peter!", "greeting EQ Hello Peter! OK"); + + t.end(); +}); diff --git a/packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-nodejs.test.ts b/packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-nodejs.test.ts new file mode 100644 index 0000000000..fac4471d05 --- /dev/null +++ b/packages/cactus-test-tooling/src/test/typescript/integration/rustc-container/rustc-container-target-nodejs.test.ts @@ -0,0 +1,124 @@ +import path from "path"; +import test, { Test } from "tape-promise/tape"; +import temp from "temp"; +import fs from "fs-extra"; +import { LogLevelDesc } from "../../../../../../cactus-common/dist/types/main/typescript"; +import { + Containers, + RustcBuildCmd, + RustcContainer, +} from "../../../../main/typescript/public-api"; + +const logLevel: LogLevelDesc = "TRACE"; + +type HelloWorldExports = { + hello_world: () => string; + say_hello: (name: string) => string; +}; + +test("compiles Rust code to NodeJS targeted .wasm", async (t: Test) => { + const tmpDirAffix = "cactus-test-tooling-rustc-container-test"; + temp.track(); + test.onFinish(async () => await temp.cleanup()); + const hostSourceDir = await temp.mkdir(tmpDirAffix); + + const srcDir = path.join(hostSourceDir, "./src/"); + await fs.mkdir(srcDir); + + const rustcContainer = new RustcContainer({ logLevel }); + t.ok(rustcContainer, "RustcContainer instance truthy OK"); + + test.onFinish(async () => { + await rustcContainer.stop(); + }); + + const dockerodeContainer = await rustcContainer.start(); + t.ok(dockerodeContainer, "dockerodeContainer truthy OK"); + + const containerPkDir = path.join(rustcContainer.cwd, "./pkg/"); + + const cargoTomlHostDir = path.join( + __dirname, + "../../../rust/fixtures/wasm-hello-world/", + ); + const putCargoTomlRes = await Containers.putFile({ + containerOrId: dockerodeContainer, + dstFileDir: rustcContainer.cwd, + dstFileName: "Cargo.toml", + srcFileDir: cargoTomlHostDir, + srcFileName: "Cargo.toml", + }); + t.ok(putCargoTomlRes, "putCargoTomlRes truthy OK"); + t.ok(putCargoTomlRes.statusCode, "putCargoTomlRes.statusCode truthy OK"); + t.equal(putCargoTomlRes.statusCode, 200, "putCargoTomlRes.statusCode 200 OK"); + + const containerSrcDir = path.join(rustcContainer.cwd, "./src/"); + await Containers.exec(dockerodeContainer, ["mkdir", containerSrcDir]); + + const libRsHostDir = path.join( + __dirname, + "../../../rust/fixtures/wasm-hello-world/src/", + ); + const putLibRsRes = await Containers.putFile({ + containerOrId: dockerodeContainer, + dstFileDir: containerSrcDir, + dstFileName: "lib.rs", + srcFileDir: libRsHostDir, + srcFileName: "lib.rs", + }); + t.ok(putLibRsRes, "putLibRsRes truthy OK"); + t.ok(putLibRsRes.statusCode, "putLibRsRes.statusCode truthy OK"); + t.equal(putLibRsRes.statusCode, 200, "putLibRsRes.statusCode 200 OK"); + + const wasmPackBuildOut = await Containers.exec( + dockerodeContainer, + RustcBuildCmd.WASM_PACK_BUILD_NODEJS, + ); + t.ok(wasmPackBuildOut, "wasmPackBuildOut truthy OK"); + + // The list of files the wasm-pack NodeJS target produces + const expectedFiles = [ + ".gitignore", + "hello_world.d.ts", + "hello_world.js", + "hello_world_bg.wasm", + "hello_world_bg.wasm.d.ts", + "package.json", + ]; + + const filesOnFs = await Containers.ls(dockerodeContainer, containerPkDir); + t.ok(filesOnFs, "filesOnFs truthy OK"); + t.true(Array.isArray(filesOnFs), "Array.isArray(filesOnFs) OK"); + t.comment(`filesOnFs: ${JSON.stringify(filesOnFs)}`); + t.deepEqual(filesOnFs, expectedFiles, "deepEqual filesOnFs, fileNames OK"); + + const fileChecks = filesOnFs.map(async (fileName) => { + const containerFilePath = path.join(containerPkDir, fileName); + const hostFilePath = path.join(hostSourceDir, fileName); + const contentsBuffer = await Containers.pullBinaryFile( + dockerodeContainer, + containerFilePath, + ); + t.ok(contentsBuffer, `contents buffer truthy OK: ${containerFilePath}`); + t.true(contentsBuffer.length > 0, `size > 0 OK: ${containerFilePath}`); + await fs.writeFile(hostFilePath, contentsBuffer); + const { isFile, size } = await fs.stat(hostFilePath); + t.true(isFile, `isFile===true OK: ${hostFilePath}`); + t.true(size > 0, `size > 0 OK: ${hostFilePath}`); + }); + + await t.doesNotReject(Promise.all(fileChecks), "All WASM build files OK"); + + const wasmHostPath = path.join(hostSourceDir, "./hello_world.js"); + // eslint-disable-next-line @typescript-eslint/no-var-requires + const wasmModule = require(wasmHostPath) as HelloWorldExports; + const helloWorldOut = wasmModule.hello_world(); + t.ok(helloWorldOut, "helloWorldOut truthy OK"); + t.equal(helloWorldOut, "Hello World!", "helloWorldOut EQ Hello World! OK"); + + const greeting = wasmModule.say_hello("Peter"); + t.ok(greeting, "greeting truthy OK"); + t.equal(greeting, "Hello Peter!", "greeting EQ Hello Peter! OK"); + + t.end(); +}); diff --git a/tools/docker/rust-compiler/Dockerfile b/tools/docker/rust-compiler/Dockerfile new file mode 100644 index 0000000000..8f67060dfd --- /dev/null +++ b/tools/docker/rust-compiler/Dockerfile @@ -0,0 +1,7 @@ +FROM rust:1.52.1-slim-bullseye + +RUN apt update + +# wasm-pack dependencies+install +RUN apt install -y build-essential pkg-config libssl-dev +RUN cargo install wasm-pack diff --git a/tools/docker/rust-compiler/README.md b/tools/docker/rust-compiler/README.md new file mode 100644 index 0000000000..c01a59ddf6 --- /dev/null +++ b/tools/docker/rust-compiler/README.md @@ -0,0 +1,17 @@ +# @hyperledger/cactus-rust-compiler + +A container image that can be used to compile Rust source code and then also +WASM pack it where necessary/applicable. + +## Table of Contents + +- [Usage](#usage) +- [Build](#build) + +## Usage + +## Build + +```sh +DOCKER_BUILDKIT=1 docker build -f ./tools/docker/rust-compiler/Dockerfile . --tag crc +``` diff --git a/tools/docker/rust-compiler/hooks/post_push b/tools/docker/rust-compiler/hooks/post_push new file mode 100755 index 0000000000..8f41b30ce4 --- /dev/null +++ b/tools/docker/rust-compiler/hooks/post_push @@ -0,0 +1,18 @@ +#!/bin/bash + + +SHORTHASH="$(git rev-parse --short HEAD)" +TODAYS_DATE="$(date +%F)" + +# +# We tag every image with today's date and also the git short hash +# Today's date helps humans quickly intuit which version is older/newer +# And the short hash helps identify the exact git revision that the image was +# built from in case you are chasing some exotic bug that requires this sort of +# rabbithole diving where you are down to comparing the images at this level. +# +DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" + + +docker tag $IMAGE_NAME $DOCKER_REPO:$DOCKER_TAG +docker push $DOCKER_REPO:$DOCKER_TAG