Socket
Socket
Sign inDemoInstall

dprint

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dprint - npm Package Compare versions

Comparing version 0.33.0 to 0.34.0

26

bin.js

@@ -16,3 +16,3 @@ #!/usr/bin/env node

console.error(err);
process.exit(child_process.exitCode || 1);
process.exit(1);
});

@@ -24,18 +24,14 @@ } else {

function runDprintExe() {
try {
const result = child_process.spawnSync(
exePath,
process.argv.slice(2),
{ stdio: "inherit" },
);
if (result.error) {
throw result.error;
}
const result = child_process.spawnSync(
exePath,
process.argv.slice(2),
{ stdio: "inherit" },
);
if (result.error) {
throw result.error;
}
throwIfNoExePath();
throwIfNoExePath();
process.exitCode = result.status;
} catch (err) {
throw err;
}
process.exitCode = result.status;
}

@@ -42,0 +38,0 @@

{
"version": "0.33.0",
"version": "0.34.0",
"checksums": {
"windows-x86_64": "98d3e6616e23cb9b2a969975b9c34b4b571e40725b0348d19cebedcb9c584be5",
"darwin-x86_64": "d4b502bb00bd4e3e19657092648883e8d8270de32f61a0ff78af7709dc70b9b2",
"darwin-aarch64": "df3a99c68d7229125040e720990d70fcec0e16b64e7ccba266f5771e2e9e7edd",
"linux-x86_64": "77c52e21df129e96a7860163029e267f38e705bc7be014b79668ad15f6e0c8e2",
"linux-aarch64": "9762ae7b175d68d853daed32a17580b0662a3a46402053d1770ee6e7f355b2e5"
"windows-x86_64": "29da4f68d07cab10d0d90fdcf671c3ccdda15503ac5aa5c23c72534064b0e0b4",
"darwin-x86_64": "e9907275ab476897a72f99e279f137df0cea81b63a78da9367d3027ff072b18e",
"darwin-aarch64": "21a43b89adc42fc563371b6807642c8eb8669e75471a57bef67de99bd1bb7b75",
"linux-x86_64-gnu": "9bf233635ed8f0871fa7285ab40ea78c9216650073ad25ffec097b57738da268",
"linux-x86_64-musl": "227572fbcb761310dd21c2286fdc56a033f408919706895f7bf3913f241cf63a",
"linux-aarch64": "ef75ba1e02064a1f22184aab1888d0040e795e996c27c5339694e45cbad0500e"
}
}
// @ts-check
"use strict";
const crypto = require("crypto");
const fs = require("fs");
const https = require("https");
const fs = require("fs");
const crypto = require("crypto");
const os = require("os");
const path = require("path");
const url = require("url");
const HttpsProxyAgent = require("https-proxy-agent");
const yauzl = require("yauzl");
/** @type {string | undefined} */
let cachedIsMusl = undefined;

@@ -60,17 +64,5 @@ function install() {

} else if (os.platform() === "darwin") {
if (os.arch() === "arm64") {
return "aarch64-apple-darwin";
} else if (os.arch() === "x64") {
return "x86_64-apple-darwin";
} else {
throw new Error("Unsupported architecture " + os.arch() + ". Only x64 and M1 binaries are available.");
}
return `${getArch()}-apple-darwin`;
} else {
if (os.arch() === "arm64") {
return "aarch64-unknown-linux-gnu";
} else if (os.arch() === "x64") {
return "x86_64-unknown-linux-gnu";
} else {
throw new Error("Unsupported architecture " + os.arch() + ". Only x64 and aarch64 binaries are available.");
}
return `${getArch()}-unknown-linux-${getLinuxFamily()}`;
}

@@ -99,3 +91,9 @@ }

return new Promise((resolve, reject) => {
https.get(url, function(response) {
const options = {};
const proxyUrl = getProxyUrl(url);
if (proxyUrl != null) {
options.agent = new HttpsProxyAgent(proxyUrl);
}
https.get(url, options, function(response) {
if (response.statusCode >= 200 && response.statusCode <= 299) {

@@ -136,2 +134,17 @@ downloadResponse(response).then(resolve).catch(reject);

function getProxyUrl(requestUrl) {
const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
if (typeof proxyUrl !== "string" || proxyUrl.length === 0) {
return undefined;
}
if (typeof process.env.NO_PROXY === "string") {
const noProxyAddresses = process.env.NO_PROXY.split(",");
const host = url.parse(requestUrl).host;
if (noProxyAddresses.indexOf(host) >= 0) {
return undefined;
}
}
return proxyUrl;
}
function verifyZipChecksum() {

@@ -157,13 +170,5 @@ const fileData = fs.readFileSync(zipFilePath);

case "darwin":
if (os.arch() === "arm64") {
return info.checksums["darwin-aarch64"];
} else {
return info.checksums["darwin-x86_64"];
}
return info.checksums[`darwin-${getArch()}`];
default:
if (os.arch() === "arm64") {
return info.checksums["linux-aarch64"];
} else {
return info.checksums["linux-x86_64"];
}
return info.checksums[`linux-${getArch()}-${getLinuxFamily()}`];
}

@@ -218,2 +223,64 @@ }

}
function getArch() {
if (os.arch() === "arm64") {
return "aarch64";
} else if (os.arch() === "x64") {
return "x86_64";
} else {
throw new Error("Unsupported architecture " + os.arch() + ". Only x64 and aarch64 binaries are available.");
}
}
function getLinuxFamily() {
return getIsMusl() ? "musl" : "gnu";
function getIsMusl() {
// code adapted from https://github.com/lovell/detect-libc
// Copyright Apache 2.0 license, the detect-libc maintainers
if (cachedIsMusl == null) {
cachedIsMusl = innerGet();
}
return cachedIsMusl;
function innerGet() {
try {
if (os.platform() !== "linux") {
return false;
}
return isProcessReportMusl() || isConfMusl();
} catch (err) {
// just in case
console.warn("Error checking if musl.", err);
return false;
}
}
function isProcessReportMusl() {
if (!process.report) {
return false;
}
const report = process.report.getReport();
if (!report || !(report.sharedObjects instanceof Array)) {
return false;
}
return report.sharedObjects.some(o => o.includes("libc.musl-") || o.includes("ld-musl-"));
}
function isConfMusl() {
const output = getCommandOutput();
const [_, ldd1] = output.split(/[\r\n]+/);
return ldd1 && ldd1.includes("musl");
}
function getCommandOutput() {
try {
const command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
return require("child_process").execSync(command, { encoding: "utf8" });
} catch (_err) {
return "";
}
}
}
}
}

@@ -220,0 +287,0 @@

{
"name": "dprint",
"version": "0.33.0",
"version": "0.34.0",
"description": "Pluggable and configurable code formatting platform written in Rust.",

@@ -24,4 +24,5 @@ "bin": "bin.js",

"dependencies": {
"https-proxy-agent": "=5.0.1",
"yauzl": "=2.10.0"
}
}
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