dprint 0.32.1 → 0.33.0

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/info.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.32.1",
2
+ "version": "0.33.0",
3
3
  "checksums": {
4
- "windows-x86_64": "9532ec060da2d4415d417064e84bb97dbf066f163b1252cc0b322c6b9692d74f",
5
- "darwin-x86_64": "b5ddd3a179c974b3b6c01187281daa40235f07d2dc5c8525de042430c3ff7ed6",
6
- "darwin-aarch64": "ea7d0595027c425751749e293bf31bccc343a8e270b23868d94f7f32d604a267",
7
- "linux-x86_64": "def34c9b2846a4a3675f324eee97b82d1834e522bfd42476ae91a036d2d1ded9",
8
- "linux-aarch64": "78d5eb14fb337d6a026240aa999d31ed7ee94b0e77a5d7aa0ae6a8de7d38183d"
4
+ "windows-x86_64": "98d3e6616e23cb9b2a969975b9c34b4b571e40725b0348d19cebedcb9c584be5",
5
+ "darwin-x86_64": "d4b502bb00bd4e3e19657092648883e8d8270de32f61a0ff78af7709dc70b9b2",
6
+ "darwin-aarch64": "df3a99c68d7229125040e720990d70fcec0e16b64e7ccba266f5771e2e9e7edd",
7
+ "linux-x86_64": "77c52e21df129e96a7860163029e267f38e705bc7be014b79668ad15f6e0c8e2",
8
+ "linux-aarch64": "9762ae7b175d68d853daed32a17580b0662a3a46402053d1770ee6e7f355b2e5"
9
9
  }
10
10
  }
package/install_api.js CHANGED
@@ -34,7 +34,7 @@ function install() {
34
34
  }
35
35
 
36
36
  // now try to download it
37
- return downloadZipFile(url).then(() => {
37
+ return downloadZipFileWithRetries(url).then(() => {
38
38
  verifyZipChecksum();
39
39
  return extractZipFile().then(() => {
40
40
  // todo: how to just +x? does it matter?
@@ -75,6 +75,24 @@ function install() {
75
75
  }
76
76
  }
77
77
 
78
+ function downloadZipFileWithRetries(url) {
79
+ /** @param remaining {number} */
80
+ function download(remaining) {
81
+ return downloadZipFile(url)
82
+ .catch(err => {
83
+ if (remaining === 0) {
84
+ return Promise.reject(err);
85
+ } else {
86
+ console.error("Error downloading dprint zip file.", err);
87
+ console.error("Retrying download (remaining: " + remaining + ")");
88
+ return download(remaining - 1);
89
+ }
90
+ });
91
+ }
92
+
93
+ return download(3);
94
+ }
95
+
78
96
  function downloadZipFile(url) {
79
97
  return new Promise((resolve, reject) => {
80
98
  https.get(url, function(response) {
@@ -198,7 +216,7 @@ function install() {
198
216
  module.exports = {
199
217
  runInstall() {
200
218
  return install().catch(err => {
201
- if (typeof err?.message === "string") {
219
+ if (err !== undefined && typeof err.message === "string") {
202
220
  console.error(err.message);
203
221
  } else {
204
222
  console.error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dprint",
3
- "version": "0.32.1",
3
+ "version": "0.33.0",
4
4
  "description": "Pluggable and configurable code formatting platform written in Rust.",
5
5
  "bin": "bin.js",
6
6
  "scripts": {