Comparing version 1.13.1 to 1.13.2
{ | ||
"name": "aws-crt", | ||
"version": "1.13.1", | ||
"version": "1.13.2", | ||
"description": "NodeJS/browser bindings to the aws-c-* libraries", | ||
"homepage": "https://github.com/awslabs/aws-crt-nodejs", | ||
"repository": "github:awslabs/aws-crt-nodejs", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/awslabs/aws-crt-nodejs.git" | ||
}, | ||
"contributors": [ | ||
@@ -43,3 +46,5 @@ "AWS Common Runtime Team <aws-sdk-common-runtime@amazon.com>" | ||
"uuid": "^8.3.2", | ||
"yargs": "^17.2.1" | ||
"yargs": "^17.2.1", | ||
"cmake-js": "^6.3.2", | ||
"tar": "^6.1.11" | ||
}, | ||
@@ -50,7 +55,5 @@ "dependencies": { | ||
"axios": "^0.24.0", | ||
"cmake-js": "6.3.0", | ||
"crypto-js": "^4.0.0", | ||
"mqtt": "^4.3.7", | ||
"tar": "^6.1.11" | ||
"mqtt": "^4.3.7" | ||
} | ||
} |
@@ -5,3 +5,2 @@ /** | ||
*/ | ||
const os = require('os'); | ||
const fs = require("fs"); | ||
@@ -12,5 +11,5 @@ const crypto = require('crypto'); | ||
const cmake = require("cmake-js"); | ||
const axios = require("axios"); | ||
const tar = require('tar'); | ||
const build_step_tar = require("./build_dependencies/build_step_tar"); | ||
const build_step_cmake = require("./build_dependencies/build_step_cmake"); | ||
function rmRecursive(rmPath) { | ||
@@ -41,115 +40,2 @@ let rmBasePath = path.basename(rmPath); | ||
function downloadFile(fileUrl, outputLocationPath) { | ||
const writer = fs.createWriteStream(outputLocationPath); | ||
return axios({ | ||
method: 'get', | ||
url: fileUrl, | ||
responseType: 'stream', | ||
}).then(response => { | ||
return new Promise((resolve, reject) => { | ||
response.data.pipe(writer); | ||
let error = null; | ||
writer.on('error', err => { | ||
error = err; | ||
writer.close(); | ||
reject(err); | ||
}); | ||
writer.on('close', () => { | ||
if (!error) { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
function checkChecksum(url, local_file) { | ||
return axios({ | ||
method: 'get', | ||
url: url, | ||
responseType: 'text', | ||
}).then(response => { | ||
return new Promise((resolve, reject) => { | ||
const filestream = fs.createReadStream(local_file); | ||
const hash = crypto.createHash('sha256'); | ||
filestream.on('readable', () => { | ||
// Only one element is going to be produced by the | ||
// hash stream. | ||
const data = filestream.read(); | ||
if (data) | ||
hash.update(data); | ||
else { | ||
const checksum = hash.digest("hex") | ||
if (checksum === response.data) { | ||
resolve() | ||
} | ||
else { | ||
reject(new Error("source code checksum mismatch")) | ||
} | ||
} | ||
}); | ||
}); | ||
}) | ||
} | ||
async function fetchNativeCode(url, version, path) { | ||
const sourceURL = `${url}/aws-crt-${version}-source.tgz` | ||
const tarballPath = path + "source.tgz"; | ||
await downloadFile(sourceURL, tarballPath); | ||
const sourceChecksumURL = `${url}/aws-crt-${version}-source.sha256`; | ||
await checkChecksum(sourceChecksumURL, tarballPath); | ||
await tar.x({ file: tarballPath, strip: 2, C: nativeSourceDir }); | ||
} | ||
function buildLocally() { | ||
const platform = os.platform(); | ||
let arch = os.arch(); | ||
// Allow cross-compile (so OSX can do arm64 or x64 builds) via: | ||
// --target-arch ARCH | ||
if (process.argv.includes('--target-arch')) { | ||
arch = process.argv[process.argv.indexOf('--target-arch') + 1]; | ||
} | ||
// options for cmake.BuildSystem | ||
let options = { | ||
target: "install", | ||
debug: process.argv.includes('--debug'), | ||
arch: arch, | ||
out: path.join('build', `${platform}-${arch}`), | ||
cMakeOptions: { | ||
CMAKE_EXPORT_COMPILE_COMMANDS: true, | ||
CMAKE_JS_PLATFORM: platform, | ||
BUILD_TESTING: 'OFF', | ||
CMAKE_INSTALL_PREFIX: 'crt/install', | ||
CMAKE_PREFIX_PATH: 'crt/install', | ||
} | ||
} | ||
// We need to pass some extra flags to pull off cross-compiling | ||
// because cmake-js doesn't set everything we need. | ||
// | ||
// See the docs on `arch`: https://github.com/cmake-js/cmake-js/blob/v6.1.0/README.md?#runtimes | ||
// > Notice: on non-Windows systems the C++ toolset's architecture's gonna be used despite this setting. | ||
if (platform === 'darwin') { | ||
// What Node calls "x64", Apple calls "x86_64". They both agree on the term "arm64" though. | ||
options.cMakeOptions.CMAKE_OSX_ARCHITECTURES = (arch === 'x64') ? 'x86_64' : arch; | ||
} | ||
// Convert any -D arguments to this script to cmake -D arguments | ||
for (const arg of process.argv) { | ||
if (arg.startsWith('-D')) { | ||
const option = arg.substring(2).split('=') | ||
options.cMakeOptions[option[0]] = option[1] | ||
} | ||
} | ||
// Enable parallel build (ignored by cmake older than 3.12) | ||
process.env.CMAKE_BUILD_PARALLEL_LEVEL = `${Math.max(os.cpus().length, 1)}`; | ||
// Run the build | ||
var buildSystem = new cmake.BuildSystem(options); | ||
return buildSystem.build(); | ||
} | ||
async function buildFromRemoteSource(tmpPath) { | ||
@@ -170,7 +56,8 @@ if (fs.existsSync(nativeSourceDir)) { | ||
const version = JSON.parse(rawData)["version"]; | ||
await fetchNativeCode(host, version, tmpPath); | ||
// Get the file using tar, loaded as an install-time dependency (see scripts/build_dependencies) | ||
await build_step_tar.performStep(host, version, tmpPath, nativeSourceDir); | ||
// Clean up temp directory | ||
rmRecursive(tmpPath); | ||
// Kick off local build | ||
await buildLocally(); | ||
// Kick off local build using cmake-js loaded as an install-time dependency (see scripts/build_dependencies) | ||
await build_step_cmake.performStep(); | ||
// Local build finished successfully, we don't need source anymore. | ||
@@ -204,4 +91,3 @@ rmRecursive(nativeSourceDir); | ||
} else { | ||
// Kick off local build | ||
buildLocally(); | ||
build_step_cmake.performStep(); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
13126867
5
171
10305
20
2
- Removedcmake-js@6.3.0
- Removedtar@^6.1.11
- Removedansi@0.3.1(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedare-we-there-yet@1.0.6(transitive)
- Removedaxios@0.21.4(transitive)
- Removedbig-integer@1.6.52(transitive)
- Removedbinary@0.3.0(transitive)
- Removedbluebird@3.4.7(transitive)
- Removedbuffer-indexof-polyfill@1.0.2(transitive)
- Removedbuffer-shims@1.0.0(transitive)
- Removedbuffers@0.1.1(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedchainsaw@0.1.0(transitive)
- Removedchownr@1.1.42.0.0(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcmake-js@6.3.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddeep-extend@0.6.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removedduplexer2@0.1.4(transitive)
- Removedfs-extra@5.0.0(transitive)
- Removedfs-minipass@1.2.72.1.0(transitive)
- Removedfstream@1.0.12(transitive)
- Removedgauge@1.2.7(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedini@1.3.8(transitive)
- Removedinvert-kv@1.0.0(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-iojs@1.1.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedlcid@1.0.0(transitive)
- Removedlistenercount@1.0.1(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash.pad@4.5.1(transitive)
- Removedlodash.padend@4.6.1(transitive)
- Removedlodash.padstart@4.6.1(transitive)
- Removedmemory-stream@0.0.3(transitive)
- Removedminipass@2.9.03.3.65.0.0(transitive)
- Removedminizlib@1.3.32.1.2(transitive)
- Removedmkdirp@0.5.61.0.4(transitive)
- Removednpmlog@1.2.1(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedrc@1.2.8(transitive)
- Removedreadable-stream@1.0.342.1.5(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedsplitargs@0.0.7(transitive)
- Removedstring-width@1.0.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedtar@4.4.196.2.1(transitive)
- Removedtraverse@0.3.9(transitive)
- Removeduniversalify@0.1.2(transitive)
- Removedunzipper@0.8.14(transitive)
- Removedurl-join@0.0.1(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwindow-size@0.1.4(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedy18n@3.2.2(transitive)
- Removedyallist@3.1.1(transitive)
- Removedyargs@3.32.0(transitive)