dprint 0.34.0 → 0.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin.js CHANGED
@@ -10,7 +10,11 @@ const exePath = path.join(__dirname, os.platform() === "win32" ? "dprint.exe" :
10
10
 
11
11
  if (!fs.existsSync(exePath)) {
12
12
  require("./install_api").runInstall().then(() => {
13
- runDprintExe();
13
+ // I'm not sure why (I think due zip extraction), but the executable
14
+ // doesn't seem fully ready unless waiting for the next tick
15
+ setTimeout(() => {
16
+ runDprintExe();
17
+ }, 0);
14
18
  }).catch(err => {
15
19
  console.error(err);
16
20
  process.exit(1);
package/info.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "0.34.0",
2
+ "version": "0.34.4",
3
3
  "checksums": {
4
- "windows-x86_64": "29da4f68d07cab10d0d90fdcf671c3ccdda15503ac5aa5c23c72534064b0e0b4",
5
- "darwin-x86_64": "e9907275ab476897a72f99e279f137df0cea81b63a78da9367d3027ff072b18e",
6
- "darwin-aarch64": "21a43b89adc42fc563371b6807642c8eb8669e75471a57bef67de99bd1bb7b75",
7
- "linux-x86_64-gnu": "9bf233635ed8f0871fa7285ab40ea78c9216650073ad25ffec097b57738da268",
8
- "linux-x86_64-musl": "227572fbcb761310dd21c2286fdc56a033f408919706895f7bf3913f241cf63a",
9
- "linux-aarch64": "ef75ba1e02064a1f22184aab1888d0040e795e996c27c5339694e45cbad0500e"
4
+ "x86_64-pc-windows-msvc": "209e751b693f1c076fbd3d204af01bcb5c10be3f9dd99106bd14145e98de01fc",
5
+ "x86_64-apple-darwin": "74a1751e335ffde8385fb415365290b81d26f3509007a0cead1f62f8bb6d0e37",
6
+ "aarch64-apple-darwin": "bb052fa8f0cc995c09563adb07fb554a5386c2ed1152ba97a76734ed6ac55c4e",
7
+ "x86_64-unknown-linux-gnu": "3019e6bb9f1d97b1529e37808556715b38d43753bffeb12396fa06ea72156d9f",
8
+ "x86_64-unknown-linux-musl": "088d41a1b13b4623148119af9a3c2f618794170484294c210d5acd64f94a5cc6",
9
+ "aarch64-unknown-linux-gnu": "80607da90a920448d4361ad4993f7c5e770f3e8b6062d492ac00dd2eb558f256"
10
10
  }
11
11
  }
package/install_api.js CHANGED
@@ -26,7 +26,7 @@ function install() {
26
26
  const zipFilePath = path.join(__dirname, "dprint.zip");
27
27
 
28
28
  const target = getTarget();
29
- const url = "https://github.com/dprint/dprint/releases/download/"
29
+ const downloadUrl = "https://github.com/dprint/dprint/releases/download/"
30
30
  + info.version
31
31
  + "/dprint-" + target + ".zip";
32
32
 
@@ -38,7 +38,7 @@ function install() {
38
38
  }
39
39
 
40
40
  // now try to download it
41
- return downloadZipFileWithRetries(url).then(() => {
41
+ return downloadZipFileWithRetries(downloadUrl).then(() => {
42
42
  verifyZipChecksum();
43
43
  return extractZipFile().then(() => {
44
44
  // todo: how to just +x? does it matter?
@@ -94,7 +94,7 @@ function install() {
94
94
  }
95
95
 
96
96
  https.get(url, options, function(response) {
97
- if (response.statusCode >= 200 && response.statusCode <= 299) {
97
+ if (response.statusCode != null && response.statusCode >= 200 && response.statusCode <= 299) {
98
98
  downloadResponse(response).then(resolve).catch(reject);
99
99
  } else if (response.headers.location) {
100
100
  downloadZipFile(response.headers.location).then(resolve).catch(reject);
@@ -121,7 +121,7 @@ function install() {
121
121
  if (err) {
122
122
  reject(err);
123
123
  } else {
124
- resolve();
124
+ resolve(undefined);
125
125
  }
126
126
  });
127
127
  });
@@ -130,18 +130,23 @@ function install() {
130
130
  }
131
131
 
132
132
  function getProxyUrl(requestUrl) {
133
- const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
134
- if (typeof proxyUrl !== "string" || proxyUrl.length === 0) {
135
- return undefined;
136
- }
137
- if (typeof process.env.NO_PROXY === "string") {
138
- const noProxyAddresses = process.env.NO_PROXY.split(",");
139
- const host = url.parse(requestUrl).host;
140
- if (noProxyAddresses.indexOf(host) >= 0) {
133
+ try {
134
+ const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
135
+ if (typeof proxyUrl !== "string" || proxyUrl.length === 0) {
141
136
  return undefined;
142
137
  }
138
+ if (typeof process.env.NO_PROXY === "string") {
139
+ const noProxyAddresses = process.env.NO_PROXY.split(",");
140
+ const host = url.parse(requestUrl).host;
141
+ if (host == null || noProxyAddresses.indexOf(host) >= 0) {
142
+ return undefined;
143
+ }
144
+ }
145
+ return proxyUrl;
146
+ } catch (err) {
147
+ console.error("[dprint]: Error getting proxy url.", err);
148
+ return undefined;
143
149
  }
144
- return proxyUrl;
145
150
  }
146
151
 
147
152
  function verifyZipChecksum() {
@@ -160,14 +165,11 @@ function install() {
160
165
  }
161
166
 
162
167
  function getExpectedZipChecksum() {
163
- switch (os.platform()) {
164
- case "win32":
165
- return info.checksums["windows-x86_64"];
166
- case "darwin":
167
- return info.checksums[`darwin-${getArch()}`];
168
- default:
169
- return info.checksums[`linux-${getArch()}-${getLinuxFamily()}`];
168
+ const checksum = info.checksums[getTarget()];
169
+ if (checksum == null) {
170
+ throw new Error("Could not find checksum for target: " + checksum);
170
171
  }
172
+ return checksum;
171
173
  }
172
174
  }
173
175
 
@@ -202,7 +204,7 @@ function install() {
202
204
  reject(err);
203
205
  });
204
206
  writeStream.on("finish", () => {
205
- resolve();
207
+ resolve(undefined);
206
208
  });
207
209
  });
208
210
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dprint",
3
- "version": "0.34.0",
3
+ "version": "0.34.4",
4
4
  "description": "Pluggable and configurable code formatting platform written in Rust.",
5
5
  "bin": "bin.js",
6
6
  "scripts": {