jjpwrgem 0.5.4 → 0.6.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.
@@ -0,0 +1 @@
1
+ package.json
package/binary-install.js CHANGED
@@ -1,10 +1,21 @@
1
- const { createWriteStream, existsSync, mkdirSync, mkdtemp } = require("fs");
1
+ // Derived from cargo-dist (https://github.com/axodotdev/cargo-dist)
2
+ // Copyright (c) 2022-2024 Axo Developer Co.
3
+ // Licensed under MIT OR Apache-2.0
4
+
5
+ const {
6
+ createWriteStream,
7
+ existsSync,
8
+ mkdirSync,
9
+ mkdtemp,
10
+ rmSync,
11
+ } = require("fs");
2
12
  const { join, sep } = require("path");
3
13
  const { spawnSync } = require("child_process");
4
14
  const { tmpdir } = require("os");
5
15
 
6
- const axios = require("axios");
7
- const rimraf = require("rimraf");
16
+ const https = require("node:https");
17
+ const http = require("node:http");
18
+
8
19
  const tmpDir = tmpdir();
9
20
 
10
21
  const error = (msg) => {
@@ -12,6 +23,131 @@ const error = (msg) => {
12
23
  process.exit(1);
13
24
  };
14
25
 
26
+ function getProxyForUrl(urlString) {
27
+ const url = new URL(urlString);
28
+ const isHttps = url.protocol === "https:";
29
+
30
+ const noProxy = process.env.NO_PROXY || process.env.no_proxy || "";
31
+ if (noProxy === "*") return null;
32
+ if (noProxy) {
33
+ const hostname = url.hostname.toLowerCase();
34
+ const noProxyList = noProxy.split(",").map((s) => s.trim().toLowerCase());
35
+ for (const entry of noProxyList) {
36
+ if (hostname === entry || hostname.endsWith("." + entry)) {
37
+ return null;
38
+ }
39
+ }
40
+ }
41
+
42
+ const proxyEnv = isHttps
43
+ ? process.env.HTTPS_PROXY || process.env.https_proxy
44
+ : process.env.HTTP_PROXY || process.env.http_proxy;
45
+
46
+ if (!proxyEnv) return null;
47
+
48
+ const proxyUrl = new URL(proxyEnv);
49
+ return {
50
+ hostname: proxyUrl.hostname,
51
+ port: proxyUrl.port || (proxyUrl.protocol === "https:" ? 443 : 80),
52
+ auth: proxyUrl.username
53
+ ? `${proxyUrl.username}:${proxyUrl.password}`
54
+ : null,
55
+ };
56
+ }
57
+
58
+ function connectThroughProxy(proxy, target) {
59
+ return new Promise((resolve, reject) => {
60
+ const headers = {};
61
+ if (proxy.auth) {
62
+ headers["Proxy-Authorization"] =
63
+ "Basic " + Buffer.from(proxy.auth).toString("base64");
64
+ }
65
+
66
+ const connectReq = http.request({
67
+ hostname: proxy.hostname,
68
+ port: proxy.port,
69
+ method: "CONNECT",
70
+ path: `${target.hostname}:${target.port || 443}`,
71
+ headers,
72
+ });
73
+ connectReq.on("connect", (res, socket) => {
74
+ if (res.statusCode === 200) {
75
+ resolve(socket);
76
+ } else {
77
+ reject(new Error(`Proxy CONNECT failed with status ${res.statusCode}`));
78
+ }
79
+ });
80
+ connectReq.on("error", reject);
81
+ connectReq.end();
82
+ });
83
+ }
84
+
85
+ function download(urlString, maxRedirects) {
86
+ if (maxRedirects === undefined) maxRedirects = 5;
87
+ return new Promise((resolve, reject) => {
88
+ if (maxRedirects < 0) {
89
+ return reject(new Error("Too many redirects"));
90
+ }
91
+
92
+ const parsed = new URL(urlString);
93
+ const isHttps = parsed.protocol === "https:";
94
+ const mod = isHttps ? https : http;
95
+ const proxy = getProxyForUrl(urlString);
96
+
97
+ const doRequest = (extraOptions) => {
98
+ const options = Object.assign(
99
+ {
100
+ hostname: parsed.hostname,
101
+ port: parsed.port || (isHttps ? 443 : 80),
102
+ path: parsed.pathname + parsed.search,
103
+ method: "GET",
104
+ headers: { "User-Agent": "cargo-dist-npm-installer" },
105
+ },
106
+ extraOptions || {},
107
+ );
108
+
109
+ if (proxy && !isHttps) {
110
+ // HTTP through HTTP proxy: request the full URL via the proxy
111
+ options.hostname = proxy.hostname;
112
+ options.port = proxy.port;
113
+ options.path = urlString;
114
+ if (proxy.auth) {
115
+ options.headers["Proxy-Authorization"] =
116
+ "Basic " + Buffer.from(proxy.auth).toString("base64");
117
+ }
118
+ }
119
+
120
+ const req = mod.request(options, (res) => {
121
+ if (
122
+ res.statusCode >= 300 &&
123
+ res.statusCode < 400 &&
124
+ res.headers.location
125
+ ) {
126
+ res.resume();
127
+ const nextUrl = new URL(res.headers.location, urlString).toString();
128
+ return download(nextUrl, maxRedirects - 1).then(resolve, reject);
129
+ }
130
+ if (res.statusCode < 200 || res.statusCode >= 300) {
131
+ res.resume();
132
+ return reject(new Error(`HTTP ${res.statusCode} from ${urlString}`));
133
+ }
134
+ resolve(res);
135
+ });
136
+ req.on("error", reject);
137
+ req.end();
138
+ };
139
+
140
+ if (proxy && isHttps) {
141
+ connectThroughProxy(proxy, parsed).then(
142
+ (socket) => doRequest({ socket, agent: false }),
143
+ reject,
144
+ );
145
+ } else {
146
+ doRequest();
147
+ }
148
+ });
149
+ }
150
+
15
151
  class Package {
16
152
  constructor(platform, name, url, filename, zipExt, binaries) {
17
153
  let errors = [];
@@ -72,7 +208,7 @@ class Package {
72
208
  return true;
73
209
  }
74
210
 
75
- install(fetchOptions, suppressLogs = false) {
211
+ install(suppressLogs = false) {
76
212
  if (this.exists()) {
77
213
  if (!suppressLogs) {
78
214
  console.error(
@@ -82,8 +218,10 @@ class Package {
82
218
  return Promise.resolve();
83
219
  }
84
220
 
85
- if (existsSync(this.installDirectory)) {
86
- rimraf.sync(this.installDirectory);
221
+ try {
222
+ rmSync(this.installDirectory, { recursive: true, force: true });
223
+ } catch {
224
+ // ignore - directory may not exist
87
225
  }
88
226
 
89
227
  mkdirSync(this.installDirectory, { recursive: true });
@@ -92,12 +230,13 @@ class Package {
92
230
  console.error(`Downloading release from ${this.url}`);
93
231
  }
94
232
 
95
- return axios({ ...fetchOptions, url: this.url, responseType: "stream" })
233
+ return download(this.url)
96
234
  .then((res) => {
97
235
  return new Promise((resolve, reject) => {
98
236
  mkdtemp(`${tmpDir}${sep}`, (err, directory) => {
237
+ if (err) return reject(err);
99
238
  let tempFile = join(directory, this.filename);
100
- const sink = res.data.pipe(createWriteStream(tempFile));
239
+ const sink = res.pipe(createWriteStream(tempFile));
101
240
  sink.on("error", (err) => reject(err));
102
241
  sink.on("close", () => {
103
242
  if (/\.tar\.*/.test(this.zipExt)) {
@@ -178,10 +317,8 @@ class Package {
178
317
  });
179
318
  }
180
319
 
181
- run(binaryName, fetchOptions) {
182
- const promise = !this.exists()
183
- ? this.install(fetchOptions, true)
184
- : Promise.resolve();
320
+ run(binaryName) {
321
+ const promise = !this.exists() ? this.install(true) : Promise.resolve();
185
322
 
186
323
  promise
187
324
  .then(() => {
@@ -204,7 +341,6 @@ class Package {
204
341
  })
205
342
  .catch((e) => {
206
343
  error(e.message);
207
- process.exit(1);
208
344
  });
209
345
  }
210
346
  }
package/binary.js CHANGED
@@ -1,7 +1,10 @@
1
+ // Derived from cargo-dist (https://github.com/axodotdev/cargo-dist)
2
+ // Copyright (c) 2022-2024 Axo Developer Co.
3
+ // Licensed under MIT OR Apache-2.0
4
+
1
5
  const { Package } = require("./binary-install");
2
6
  const os = require("os");
3
7
  const libc = require("detect-libc");
4
- const { configureProxy } = require("axios-proxy-builder");
5
8
 
6
9
  const error = (msg) => {
7
10
  console.error(msg);
@@ -105,17 +108,15 @@ const install = (suppressLogs) => {
105
108
  console.warn("in demo mode, not installing binaries");
106
109
  return;
107
110
  }
108
- const package = getPackage();
109
- const proxy = configureProxy(package.url);
111
+ const pkg = getPackage();
110
112
 
111
- return package.install(proxy, suppressLogs);
113
+ return pkg.install(suppressLogs);
112
114
  };
113
115
 
114
116
  const run = (binaryName) => {
115
- const package = getPackage();
116
- const proxy = configureProxy(package.url);
117
+ const pkg = getPackage();
117
118
 
118
- package.run(binaryName, proxy);
119
+ pkg.run(binaryName);
119
120
  };
120
121
 
121
122
  module.exports = {
@@ -1,19 +1,16 @@
1
1
  {
2
2
  "name": "jjpwrgem",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "jjpwrgem",
9
- "version": "0.5.4",
9
+ "version": "0.6.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "axios": "^1.12.2",
14
- "axios-proxy-builder": "^0.1.2",
15
- "detect-libc": "^2.1.2",
16
- "rimraf": "^6.0.1"
13
+ "detect-libc": "^2.1.2"
17
14
  },
18
15
  "bin": {
19
16
  "jjp": "run-jjp.js"
@@ -24,87 +21,6 @@
24
21
  "npm": ">=6"
25
22
  }
26
23
  },
27
- "node_modules/@isaacs/balanced-match": {
28
- "version": "4.0.1",
29
- "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz",
30
- "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==",
31
- "license": "MIT",
32
- "engines": {
33
- "node": "20 || >=22"
34
- }
35
- },
36
- "node_modules/@isaacs/brace-expansion": {
37
- "version": "5.0.0",
38
- "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz",
39
- "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==",
40
- "license": "MIT",
41
- "dependencies": {
42
- "@isaacs/balanced-match": "^4.0.1"
43
- },
44
- "engines": {
45
- "node": "20 || >=22"
46
- }
47
- },
48
- "node_modules/asynckit": {
49
- "version": "0.4.0",
50
- "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
51
- "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
52
- "license": "MIT"
53
- },
54
- "node_modules/axios": {
55
- "version": "1.13.2",
56
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
57
- "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
58
- "license": "MIT",
59
- "dependencies": {
60
- "follow-redirects": "^1.15.6",
61
- "form-data": "^4.0.4",
62
- "proxy-from-env": "^1.1.0"
63
- }
64
- },
65
- "node_modules/axios-proxy-builder": {
66
- "version": "0.1.2",
67
- "resolved": "https://registry.npmjs.org/axios-proxy-builder/-/axios-proxy-builder-0.1.2.tgz",
68
- "integrity": "sha512-6uBVsBZzkB3tCC8iyx59mCjQckhB8+GQrI9Cop8eC7ybIsvs/KtnNgEBfRMSEa7GqK2VBGUzgjNYMdPIfotyPA==",
69
- "license": "MIT",
70
- "dependencies": {
71
- "tunnel": "^0.0.6"
72
- }
73
- },
74
- "node_modules/call-bind-apply-helpers": {
75
- "version": "1.0.2",
76
- "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
77
- "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
78
- "license": "MIT",
79
- "dependencies": {
80
- "es-errors": "^1.3.0",
81
- "function-bind": "^1.1.2"
82
- },
83
- "engines": {
84
- "node": ">= 0.4"
85
- }
86
- },
87
- "node_modules/combined-stream": {
88
- "version": "1.0.8",
89
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
90
- "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
91
- "license": "MIT",
92
- "dependencies": {
93
- "delayed-stream": "~1.0.0"
94
- },
95
- "engines": {
96
- "node": ">= 0.8"
97
- }
98
- },
99
- "node_modules/delayed-stream": {
100
- "version": "1.0.0",
101
- "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
102
- "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
103
- "license": "MIT",
104
- "engines": {
105
- "node": ">=0.4.0"
106
- }
107
- },
108
24
  "node_modules/detect-libc": {
109
25
  "version": "2.1.2",
110
26
  "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
@@ -113,334 +29,6 @@
113
29
  "engines": {
114
30
  "node": ">=8"
115
31
  }
116
- },
117
- "node_modules/dunder-proto": {
118
- "version": "1.0.1",
119
- "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
120
- "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
121
- "license": "MIT",
122
- "dependencies": {
123
- "call-bind-apply-helpers": "^1.0.1",
124
- "es-errors": "^1.3.0",
125
- "gopd": "^1.2.0"
126
- },
127
- "engines": {
128
- "node": ">= 0.4"
129
- }
130
- },
131
- "node_modules/es-define-property": {
132
- "version": "1.0.1",
133
- "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
134
- "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
135
- "license": "MIT",
136
- "engines": {
137
- "node": ">= 0.4"
138
- }
139
- },
140
- "node_modules/es-errors": {
141
- "version": "1.3.0",
142
- "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
143
- "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
144
- "license": "MIT",
145
- "engines": {
146
- "node": ">= 0.4"
147
- }
148
- },
149
- "node_modules/es-object-atoms": {
150
- "version": "1.1.1",
151
- "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
152
- "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
153
- "license": "MIT",
154
- "dependencies": {
155
- "es-errors": "^1.3.0"
156
- },
157
- "engines": {
158
- "node": ">= 0.4"
159
- }
160
- },
161
- "node_modules/es-set-tostringtag": {
162
- "version": "2.1.0",
163
- "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
164
- "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
165
- "license": "MIT",
166
- "dependencies": {
167
- "es-errors": "^1.3.0",
168
- "get-intrinsic": "^1.2.6",
169
- "has-tostringtag": "^1.0.2",
170
- "hasown": "^2.0.2"
171
- },
172
- "engines": {
173
- "node": ">= 0.4"
174
- }
175
- },
176
- "node_modules/follow-redirects": {
177
- "version": "1.15.11",
178
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
179
- "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
180
- "funding": [
181
- {
182
- "type": "individual",
183
- "url": "https://github.com/sponsors/RubenVerborgh"
184
- }
185
- ],
186
- "license": "MIT",
187
- "engines": {
188
- "node": ">=4.0"
189
- },
190
- "peerDependenciesMeta": {
191
- "debug": {
192
- "optional": true
193
- }
194
- }
195
- },
196
- "node_modules/form-data": {
197
- "version": "4.0.5",
198
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
199
- "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
200
- "license": "MIT",
201
- "dependencies": {
202
- "asynckit": "^0.4.0",
203
- "combined-stream": "^1.0.8",
204
- "es-set-tostringtag": "^2.1.0",
205
- "hasown": "^2.0.2",
206
- "mime-types": "^2.1.12"
207
- },
208
- "engines": {
209
- "node": ">= 6"
210
- }
211
- },
212
- "node_modules/function-bind": {
213
- "version": "1.1.2",
214
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
215
- "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
216
- "license": "MIT",
217
- "funding": {
218
- "url": "https://github.com/sponsors/ljharb"
219
- }
220
- },
221
- "node_modules/get-intrinsic": {
222
- "version": "1.3.0",
223
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
224
- "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
225
- "license": "MIT",
226
- "dependencies": {
227
- "call-bind-apply-helpers": "^1.0.2",
228
- "es-define-property": "^1.0.1",
229
- "es-errors": "^1.3.0",
230
- "es-object-atoms": "^1.1.1",
231
- "function-bind": "^1.1.2",
232
- "get-proto": "^1.0.1",
233
- "gopd": "^1.2.0",
234
- "has-symbols": "^1.1.0",
235
- "hasown": "^2.0.2",
236
- "math-intrinsics": "^1.1.0"
237
- },
238
- "engines": {
239
- "node": ">= 0.4"
240
- },
241
- "funding": {
242
- "url": "https://github.com/sponsors/ljharb"
243
- }
244
- },
245
- "node_modules/get-proto": {
246
- "version": "1.0.1",
247
- "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
248
- "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
249
- "license": "MIT",
250
- "dependencies": {
251
- "dunder-proto": "^1.0.1",
252
- "es-object-atoms": "^1.0.0"
253
- },
254
- "engines": {
255
- "node": ">= 0.4"
256
- }
257
- },
258
- "node_modules/glob": {
259
- "version": "13.0.0",
260
- "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz",
261
- "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==",
262
- "license": "BlueOak-1.0.0",
263
- "dependencies": {
264
- "minimatch": "^10.1.1",
265
- "minipass": "^7.1.2",
266
- "path-scurry": "^2.0.0"
267
- },
268
- "engines": {
269
- "node": "20 || >=22"
270
- },
271
- "funding": {
272
- "url": "https://github.com/sponsors/isaacs"
273
- }
274
- },
275
- "node_modules/gopd": {
276
- "version": "1.2.0",
277
- "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
278
- "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
279
- "license": "MIT",
280
- "engines": {
281
- "node": ">= 0.4"
282
- },
283
- "funding": {
284
- "url": "https://github.com/sponsors/ljharb"
285
- }
286
- },
287
- "node_modules/has-symbols": {
288
- "version": "1.1.0",
289
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
290
- "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
291
- "license": "MIT",
292
- "engines": {
293
- "node": ">= 0.4"
294
- },
295
- "funding": {
296
- "url": "https://github.com/sponsors/ljharb"
297
- }
298
- },
299
- "node_modules/has-tostringtag": {
300
- "version": "1.0.2",
301
- "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
302
- "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
303
- "license": "MIT",
304
- "dependencies": {
305
- "has-symbols": "^1.0.3"
306
- },
307
- "engines": {
308
- "node": ">= 0.4"
309
- },
310
- "funding": {
311
- "url": "https://github.com/sponsors/ljharb"
312
- }
313
- },
314
- "node_modules/hasown": {
315
- "version": "2.0.2",
316
- "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
317
- "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
318
- "license": "MIT",
319
- "dependencies": {
320
- "function-bind": "^1.1.2"
321
- },
322
- "engines": {
323
- "node": ">= 0.4"
324
- }
325
- },
326
- "node_modules/lru-cache": {
327
- "version": "11.2.4",
328
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz",
329
- "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==",
330
- "license": "BlueOak-1.0.0",
331
- "engines": {
332
- "node": "20 || >=22"
333
- }
334
- },
335
- "node_modules/math-intrinsics": {
336
- "version": "1.1.0",
337
- "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
338
- "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
339
- "license": "MIT",
340
- "engines": {
341
- "node": ">= 0.4"
342
- }
343
- },
344
- "node_modules/mime-db": {
345
- "version": "1.52.0",
346
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
347
- "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
348
- "license": "MIT",
349
- "engines": {
350
- "node": ">= 0.6"
351
- }
352
- },
353
- "node_modules/mime-types": {
354
- "version": "2.1.35",
355
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
356
- "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
357
- "license": "MIT",
358
- "dependencies": {
359
- "mime-db": "1.52.0"
360
- },
361
- "engines": {
362
- "node": ">= 0.6"
363
- }
364
- },
365
- "node_modules/minimatch": {
366
- "version": "10.1.1",
367
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz",
368
- "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==",
369
- "license": "BlueOak-1.0.0",
370
- "dependencies": {
371
- "@isaacs/brace-expansion": "^5.0.0"
372
- },
373
- "engines": {
374
- "node": "20 || >=22"
375
- },
376
- "funding": {
377
- "url": "https://github.com/sponsors/isaacs"
378
- }
379
- },
380
- "node_modules/minipass": {
381
- "version": "7.1.2",
382
- "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
383
- "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
384
- "license": "ISC",
385
- "engines": {
386
- "node": ">=16 || 14 >=14.17"
387
- }
388
- },
389
- "node_modules/package-json-from-dist": {
390
- "version": "1.0.1",
391
- "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
392
- "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
393
- "license": "BlueOak-1.0.0"
394
- },
395
- "node_modules/path-scurry": {
396
- "version": "2.0.1",
397
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz",
398
- "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==",
399
- "license": "BlueOak-1.0.0",
400
- "dependencies": {
401
- "lru-cache": "^11.0.0",
402
- "minipass": "^7.1.2"
403
- },
404
- "engines": {
405
- "node": "20 || >=22"
406
- },
407
- "funding": {
408
- "url": "https://github.com/sponsors/isaacs"
409
- }
410
- },
411
- "node_modules/proxy-from-env": {
412
- "version": "1.1.0",
413
- "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
414
- "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
415
- "license": "MIT"
416
- },
417
- "node_modules/rimraf": {
418
- "version": "6.1.2",
419
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz",
420
- "integrity": "sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==",
421
- "license": "BlueOak-1.0.0",
422
- "dependencies": {
423
- "glob": "^13.0.0",
424
- "package-json-from-dist": "^1.0.1"
425
- },
426
- "bin": {
427
- "rimraf": "dist/esm/bin.mjs"
428
- },
429
- "engines": {
430
- "node": "20 || >=22"
431
- },
432
- "funding": {
433
- "url": "https://github.com/sponsors/isaacs"
434
- }
435
- },
436
- "node_modules/tunnel": {
437
- "version": "0.0.6",
438
- "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
439
- "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
440
- "license": "MIT",
441
- "engines": {
442
- "node": ">=0.6.11 <=0.7.0 || >=0.7.3"
443
- }
444
32
  }
445
33
  }
446
34
  }
package/package.json CHANGED
@@ -1,45 +1,43 @@
1
1
  {
2
2
  "name": "jjpwrgem",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
+ "private": false,
4
5
  "description": "jjpwrgem json parser with really good error messages",
5
6
  "keywords": [
6
7
  "command-line-utilities",
7
- "text-processing",
8
8
  "encoding",
9
- "parser",
10
9
  "formatter",
11
10
  "json",
12
- "linter"
11
+ "linter",
12
+ "parser",
13
+ "text-processing"
13
14
  ],
14
15
  "homepage": "https://github.com/20jasper/jjpwrgem",
15
16
  "license": "MIT",
16
17
  "author": "Jacob Asper <jacobasper191@gmail.com>",
17
- "main": "",
18
+ "repository": "https://github.com/20jasper/jjpwrgem",
18
19
  "bin": {
19
20
  "jjp": "run-jjp.js"
20
21
  },
21
- "repository": "https://github.com/20jasper/jjpwrgem",
22
+ "type": "",
23
+ "main": "",
22
24
  "scripts": {
23
25
  "postinstall": "node ./install.js"
24
26
  },
25
27
  "dependencies": {
26
- "axios": "^1.12.2",
27
- "detect-libc": "^2.1.2",
28
- "axios-proxy-builder": "^0.1.2",
29
- "rimraf": "^6.0.1"
28
+ "detect-libc": "^2.1.2"
30
29
  },
31
30
  "devDependencies": {},
32
31
  "engines": {
33
- "npm": ">=6",
34
- "node": ">=14"
32
+ "node": ">=14",
33
+ "npm": ">=6"
35
34
  },
36
- "private": false,
37
- "type": "",
35
+ "artifactDownloadUrl": "https://github.com/20jasper/jjpwrgem/releases/download/jjpwrgem-v0.6.0",
38
36
  "glibcMinimum": {
39
37
  "major": 2,
40
38
  "series": 35
41
39
  },
42
- "artifactDownloadUrl": "https://github.com/20jasper/jjpwrgem/releases/download/jjpwrgem-v0.5.4",
40
+ "preferUnplugged": true,
43
41
  "supportedPlatforms": {
44
42
  "aarch64-apple-darwin": {
45
43
  "artifactName": "jjpwrgem-aarch64-apple-darwin.tar.xz",
@@ -90,6 +88,5 @@
90
88
  },
91
89
  "zipExt": ".zip"
92
90
  }
93
- },
94
- "preferUnplugged": true
95
- }
91
+ }
92
+ }
package/README.md DELETED
@@ -1,115 +0,0 @@
1
- <!-- GENERATED FILE - update the templates in the xtask -->
2
-
3
- # JJPWRGEM
4
-
5
- JJPWRGEM JSON Parser With Really Good Error Messages
6
-
7
- An RFC 8259 compliant JSON Parser and formatter!
8
-
9
- ![A logo of an axolotl riding a skateboard](./logo.webp)
10
-
11
- ```
12
- $ echo -en "{\"coolKey\"}" | jjp check
13
- error: expected colon after key, found `}`
14
- --> stdin:1:11
15
- |
16
- 1 | {"coolKey"}
17
- | ---------^
18
- | |
19
- | expected due to `"coolKey"`
20
- |
21
- help: insert colon and placeholder value
22
- |
23
- 1 | {"coolKey": "🐟🛹"}
24
- | ++++++++
25
-
26
- ```
27
-
28
- ## Table of contents
29
-
30
- - [Table of contents](#table-of-contents)
31
- - [Installation](#installation)
32
- - [Stability](#stability)
33
- - [FAQ](#faq)
34
- - [Motivations](#motivations)
35
-
36
- ## Installation
37
-
38
- ### Precompiled
39
-
40
- ```bash
41
- mise use -g github:20jasper/jjpwrgem
42
- ```
43
-
44
- See [releases](https://github.com/20jasper/JJPWRGEM/releases) for shell and powershell installation instructions and raw binaries
45
-
46
- Note: node adds ~60ms of overhead
47
-
48
- ```bash
49
- npm install -g jjpwrgem
50
- ```
51
-
52
- ### From source
53
-
54
- ```bash
55
- cargo install --path .
56
- ```
57
-
58
- ## Stability
59
-
60
- JJPWRGEM is in its infancy and extremely likely to have breaking changes (properly marked with semver of course!)
61
-
62
- ## Indeterminate Handling
63
-
64
- How cases undefined by the spec are handled
65
-
66
- - numbers of any size or length are allowed
67
- - the original precision will be maintained
68
- - -0 is not equal to 0 and will persist
69
- - the last duplicate key is stored
70
- - escaped and unescaped characters are considered not equal
71
- - parsing will fail if BOM is included
72
- - only utf8 encoding is supported
73
- - no limitations on nesting or length
74
- - extensions such as trailing commas or comments are not allowed
75
- - surrogates are not validated, eg a lone continuation byte is valid
76
-
77
- ### Is it blazingly fast™?
78
-
79
- Axolotls can't walk so fast, so skateboards are pretty fast 🛹🐟
80
-
81
- jjpwrgem can parse and pretty print a 1.7MB JSON file in around ~11ms and the average package.json in ~500 microseconds
82
-
83
- See the [benchmarks](/benchmarks.md) for more info!
84
-
85
- ## FAQ
86
-
87
- ### What does JJPWRGEM stand for?
88
-
89
- JJPWRGEM JSON Parser With Really Good Error Messages. I was inspired by GNU to make a recursive acronym
90
-
91
- ### How do you pronounce JJPWRGEM?
92
-
93
- /ˈdʒeɪ dʒeɪ ˈpaʊər dʒɛm/ JAY-jay-POW-er-jem
94
-
95
- ### But why is it called that?
96
-
97
- It sounds cool and the name isn't taken on any package managers
98
-
99
- ### Why is the logo an axolotl riding a skateboard?
100
-
101
- It's cool
102
-
103
- ### How long is an axolotl?
104
-
105
- According to the San Diego zoo, "[a]n axolotl can reach 12 inches in length, but on average grows to about 9 inches[^axolotlFact]"
106
-
107
- [^axolotlFact]: https://animals.sandiegozoo.org/animals/axolotl
108
-
109
- ## Motivations
110
-
111
- I originally started this project to practice finite state machines, but got back into it when hearing about the internals of some formatters and compilers!
112
-
113
- I am heavily inspired by the Rust compiler's error messages. I love that unhelpful errors are considered bugs
114
-
115
- I checked out several JSON parsers and formatters, and none provided much context on _why_ a key was missing. Errors ranged from "expected closing on byte 10" to a snapshot of source code for that character, but none were up to my standards