Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bs-log

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-log - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

bin/bs-log-ppx-darwin-x64.exe

2

package.json
{
"name": "bs-log",
"version": "1.1.0",
"version": "1.2.0",
"description": "Logging implementation for ReasonML/BuckleScript",

@@ -5,0 +5,0 @@ "author": "Alex Fedoseev <alex.fedoseev@gmail.com>",

@@ -1,107 +0,53 @@

var fs = require("fs");
var os = require("os");
var cp = require("child_process");
var path = require("path");
#!/usr/bin/env node
var platform = process.platform;
const fs = require("fs");
var bin = "bin.exe";
const PPX = "bs-log-ppx";
var WINDOWS_X64 = "windows-x64";
let arch = process.arch;
let platform = process.platform;
/**
* Since os.arch returns node binary's target arch, not
* the system arch.
* Credits: https://github.com/feross/arch/blob/af080ff61346315559451715c5393d8e86a6d33c/index.js#L10-L58
*/
function arch() {
/**
* The running binary is 64-bit, so the OS is clearly 64-bit.
*/
if (process.arch === "x64") {
return "x64";
}
if (arch === "ia32") {
arch = "x86";
}
/**
* All recent versions of Mac OS are 64-bit.
*/
if (process.platform === "darwin") {
return "x64";
}
if (platform === "win32") {
platform = "win";
}
/**
* On Windows, the most reliable way to detect a 64-bit OS from within a 32-bit
* app is based on the presence of a WOW64 file: %SystemRoot%\SysNative.
* See: https://twitter.com/feross/status/776949077208510464
*/
if (process.platform === "win32") {
var useEnv = false;
try {
useEnv = !!(
process.env.SYSTEMROOT && fs.statSync(process.env.SYSTEMROOT)
);
} catch (err) {}
const filename = `bin/${PPX}-${platform}-${arch}.exe`;
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
const supported = fs.existsSync(filename);
// If %SystemRoot%\SysNative exists, we are in a WOW64 FS Redirected application.
var isWOW64 = false;
try {
isWOW64 = !!fs.statSync(path.join(sysRoot, "sysnative"));
} catch (err) {}
if (!supported) {
console.error(`${PPX} does not support this platform :(`);
console.error("");
console.error(`${PPX} comes prepacked as built binaries to avoid large`);
console.error("dependencies at build-time.");
console.error("");
console.error(`If you want ${PPX} to support this platform natively,`);
console.error("please open an issue at our repository, linked above. Please");
console.error(`specify that you are on the ${platform} platform,`);
console.error(`on the ${arch} architecture.`);
return isWOW64 ? "x64" : "x86";
}
}
/**
* On Linux, use the `getconf` command to get the architecture.
*/
if (process.platform === "linux") {
var output = cp.execSync("getconf LONG_BIT", { encoding: "utf8" });
return output === "64\n" ? "x64" : "x86";
if (platform === "win") {
if (!fs.existsSync("ppx.exe")) {
copyFileSync(filename, "ppx.exe");
fs.chmodSync("ppx.exe", 0755);
}
/**
* If none of the above, assume the architecture is 32-bit.
*/
return "x86";
} else {
if (!fs.existsSync("ppx")) {
copyFileSync(filename, "ppx");
fs.chmodSync("ppx", 0755);
}
}
// implementing it b/c we don't want to depend on fs.copyFileSync
// which appears only in node@8.x
function copyFileSync(sourcePath, destPath) {
var data = fs.readFileSync(sourcePath);
var stat = fs.statSync(sourcePath);
fs.writeFileSync(destPath, data);
fs.chmodSync(destPath, stat.mode);
}
var copyPlatformBinaries = platformPath => {
var platformBuildPath = path.join(__dirname, "bin", "platform-" + platformPath);
var sourcePath = path.join(platformBuildPath, bin);
var destBin = platformPath === WINDOWS_X64 ? "ppx.exe" : "ppx";
var destPath = path.join(__dirname, destBin);
if (fs.existsSync(destPath)) {
fs.unlinkSync(destPath);
function copyFileSync(source, dest) {
if (typeof fs.copyFileSync === "function") {
fs.copyFileSync(source, dest);
} else {
fs.writeFileSync(dest, fs.readFileSync(source));
}
copyFileSync(sourcePath, destPath);
fs.chmodSync(destPath, 0777);
};
switch (platform) {
case "win32":
if (arch() !== "x64") {
console.warn("error: x86 is currently not supported on Windows");
process.exit(1);
}
copyPlatformBinaries(WINDOWS_X64);
break;
case "linux":
case "darwin":
copyPlatformBinaries(platform);
break;
default:
console.warn("error: no release built for the " + platform + " platform");
process.exit(1);
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc