@rg-dev/stdlib 1.0.41 → 1.0.43
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/lib/browser-env.cjs +3 -2
- package/lib/browser-env.js +3 -2
- package/lib/common-env.cjs +18 -3
- package/lib/common-env.js +21 -3
- package/lib/index.d.cts +4 -2
- package/lib/index.d.ts +4 -2
- package/lib/node-download.cjs +258 -130
- package/lib/node-download.js +258 -130
- package/lib/node-env.cjs +30 -12
- package/lib/node-env.d.cts +3 -1
- package/lib/node-env.d.ts +3 -1
- package/lib/node-env.js +30 -12
- package/package.json +2 -2
- package/lib/index.cjs +0 -0
- package/lib/index.js +0 -0
package/lib/node-env.cjs
CHANGED
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
7
21
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
22
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
23
|
};
|
|
@@ -28,6 +42,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
42
|
mod
|
|
29
43
|
));
|
|
30
44
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
46
|
|
|
32
47
|
// node_modules/command-exists/lib/command-exists.js
|
|
33
48
|
var require_command_exists = __commonJS({
|
|
@@ -196,7 +211,8 @@ __export(node_env_exports, {
|
|
|
196
211
|
createTempDir: () => createTempDir,
|
|
197
212
|
createTempFilePath: () => createTempFilePath,
|
|
198
213
|
isWindows: () => isWindows,
|
|
199
|
-
throwIfDirNotEmpty: () => throwIfDirNotEmpty
|
|
214
|
+
throwIfDirNotEmpty: () => throwIfDirNotEmpty,
|
|
215
|
+
typedSystemArch: () => typedSystemArch
|
|
200
216
|
});
|
|
201
217
|
module.exports = __toCommonJS(node_env_exports);
|
|
202
218
|
var fs = __toESM(require("fs-extra"), 1);
|
|
@@ -206,9 +222,9 @@ var import_command_exists = __toESM(require_command_exists2(), 1);
|
|
|
206
222
|
|
|
207
223
|
// src/SSEResponse.ts
|
|
208
224
|
var SSEResponse = class {
|
|
209
|
-
res;
|
|
210
|
-
isOpen = true;
|
|
211
225
|
constructor(resObject) {
|
|
226
|
+
__publicField(this, "res");
|
|
227
|
+
__publicField(this, "isOpen", true);
|
|
212
228
|
this.res = resObject;
|
|
213
229
|
resObject.setHeader("Content-Type", "text/event-stream");
|
|
214
230
|
resObject.setHeader("Cache-Control", "no-cache");
|
|
@@ -254,19 +270,18 @@ var SSEResponse = class {
|
|
|
254
270
|
// src/SSEClient.ts
|
|
255
271
|
var import_events = require("events");
|
|
256
272
|
var SSEClient = class extends import_events.EventEmitter {
|
|
257
|
-
url;
|
|
258
|
-
payload;
|
|
259
|
-
headers;
|
|
260
|
-
controller;
|
|
261
273
|
constructor(options) {
|
|
262
274
|
super();
|
|
275
|
+
__publicField(this, "url");
|
|
276
|
+
__publicField(this, "payload");
|
|
277
|
+
__publicField(this, "headers");
|
|
278
|
+
__publicField(this, "controller");
|
|
263
279
|
this.url = options.url;
|
|
264
280
|
this.payload = options.payload || {};
|
|
265
|
-
this.headers = {
|
|
281
|
+
this.headers = __spreadValues({
|
|
266
282
|
"Content-Type": "application/json",
|
|
267
|
-
Accept: "*/*"
|
|
268
|
-
|
|
269
|
-
};
|
|
283
|
+
Accept: "*/*"
|
|
284
|
+
}, options.headers);
|
|
270
285
|
this.controller = new AbortController();
|
|
271
286
|
}
|
|
272
287
|
async connect() {
|
|
@@ -303,7 +318,7 @@ var SSEClient = class extends import_events.EventEmitter {
|
|
|
303
318
|
let data = line.slice(5).trim();
|
|
304
319
|
try {
|
|
305
320
|
data = JSON.parse(data);
|
|
306
|
-
} catch {
|
|
321
|
+
} catch (e) {
|
|
307
322
|
}
|
|
308
323
|
this.emit(eventName, data);
|
|
309
324
|
eventName = "message";
|
|
@@ -327,6 +342,9 @@ var SSEClient = class extends import_events.EventEmitter {
|
|
|
327
342
|
function isWindows() {
|
|
328
343
|
return import_os.default.platform() === "win32";
|
|
329
344
|
}
|
|
345
|
+
function typedSystemArch() {
|
|
346
|
+
return import_os.default.arch();
|
|
347
|
+
}
|
|
330
348
|
function chmodPlusX(filePath) {
|
|
331
349
|
if (import_os.default.platform() === "win32") {
|
|
332
350
|
return;
|
package/lib/node-env.d.cts
CHANGED
|
@@ -28,6 +28,8 @@ declare class SSEClient extends EventEmitter {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
declare function isWindows(): boolean;
|
|
31
|
+
type SystemArch = "x64" | "arm64" | "arm" | "ia32" | "ppc64" | "s390x" | "loong64" | "riscv64";
|
|
32
|
+
declare function typedSystemArch(): SystemArch;
|
|
31
33
|
declare function chmodPlusX(filePath: string): void;
|
|
32
34
|
declare function checkIfDirExistsOrThrow(path: string): Promise<void>;
|
|
33
35
|
declare function createTempDir(): string;
|
|
@@ -39,4 +41,4 @@ declare function throwIfDirNotEmpty(dirPath: string): Promise<void>;
|
|
|
39
41
|
declare function checkCommandExistsOrThrow(cmd: string): Promise<void>;
|
|
40
42
|
declare function checkIfFileExistsOrThrow(thePath: string): Promise<void>;
|
|
41
43
|
|
|
42
|
-
export { SSEClient, SSEResponse, checkCommandExistsOrThrow, checkIfDirExistsOrThrow, checkIfFileExistsOrThrow, chmodPlusX, createTempDir, createTempFilePath, isWindows, throwIfDirNotEmpty };
|
|
44
|
+
export { SSEClient, SSEResponse, type SystemArch, checkCommandExistsOrThrow, checkIfDirExistsOrThrow, checkIfFileExistsOrThrow, chmodPlusX, createTempDir, createTempFilePath, isWindows, throwIfDirNotEmpty, typedSystemArch };
|
package/lib/node-env.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ declare class SSEClient extends EventEmitter {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
declare function isWindows(): boolean;
|
|
31
|
+
type SystemArch = "x64" | "arm64" | "arm" | "ia32" | "ppc64" | "s390x" | "loong64" | "riscv64";
|
|
32
|
+
declare function typedSystemArch(): SystemArch;
|
|
31
33
|
declare function chmodPlusX(filePath: string): void;
|
|
32
34
|
declare function checkIfDirExistsOrThrow(path: string): Promise<void>;
|
|
33
35
|
declare function createTempDir(): string;
|
|
@@ -39,4 +41,4 @@ declare function throwIfDirNotEmpty(dirPath: string): Promise<void>;
|
|
|
39
41
|
declare function checkCommandExistsOrThrow(cmd: string): Promise<void>;
|
|
40
42
|
declare function checkIfFileExistsOrThrow(thePath: string): Promise<void>;
|
|
41
43
|
|
|
42
|
-
export { SSEClient, SSEResponse, checkCommandExistsOrThrow, checkIfDirExistsOrThrow, checkIfFileExistsOrThrow, chmodPlusX, createTempDir, createTempFilePath, isWindows, throwIfDirNotEmpty };
|
|
44
|
+
export { SSEClient, SSEResponse, type SystemArch, checkCommandExistsOrThrow, checkIfDirExistsOrThrow, checkIfFileExistsOrThrow, chmodPlusX, createTempDir, createTempFilePath, isWindows, throwIfDirNotEmpty, typedSystemArch };
|
package/lib/node-env.js
CHANGED
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
7
21
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
22
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
23
|
}) : x)(function(x) {
|
|
@@ -29,6 +43,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
43
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
44
|
mod
|
|
31
45
|
));
|
|
46
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
47
|
|
|
33
48
|
// node_modules/command-exists/lib/command-exists.js
|
|
34
49
|
var require_command_exists = __commonJS({
|
|
@@ -193,9 +208,9 @@ import path from "path";
|
|
|
193
208
|
|
|
194
209
|
// src/SSEResponse.ts
|
|
195
210
|
var SSEResponse = class {
|
|
196
|
-
res;
|
|
197
|
-
isOpen = true;
|
|
198
211
|
constructor(resObject) {
|
|
212
|
+
__publicField(this, "res");
|
|
213
|
+
__publicField(this, "isOpen", true);
|
|
199
214
|
this.res = resObject;
|
|
200
215
|
resObject.setHeader("Content-Type", "text/event-stream");
|
|
201
216
|
resObject.setHeader("Cache-Control", "no-cache");
|
|
@@ -241,19 +256,18 @@ var SSEResponse = class {
|
|
|
241
256
|
// src/SSEClient.ts
|
|
242
257
|
import { EventEmitter } from "events";
|
|
243
258
|
var SSEClient = class extends EventEmitter {
|
|
244
|
-
url;
|
|
245
|
-
payload;
|
|
246
|
-
headers;
|
|
247
|
-
controller;
|
|
248
259
|
constructor(options) {
|
|
249
260
|
super();
|
|
261
|
+
__publicField(this, "url");
|
|
262
|
+
__publicField(this, "payload");
|
|
263
|
+
__publicField(this, "headers");
|
|
264
|
+
__publicField(this, "controller");
|
|
250
265
|
this.url = options.url;
|
|
251
266
|
this.payload = options.payload || {};
|
|
252
|
-
this.headers = {
|
|
267
|
+
this.headers = __spreadValues({
|
|
253
268
|
"Content-Type": "application/json",
|
|
254
|
-
Accept: "*/*"
|
|
255
|
-
|
|
256
|
-
};
|
|
269
|
+
Accept: "*/*"
|
|
270
|
+
}, options.headers);
|
|
257
271
|
this.controller = new AbortController();
|
|
258
272
|
}
|
|
259
273
|
async connect() {
|
|
@@ -290,7 +304,7 @@ var SSEClient = class extends EventEmitter {
|
|
|
290
304
|
let data = line.slice(5).trim();
|
|
291
305
|
try {
|
|
292
306
|
data = JSON.parse(data);
|
|
293
|
-
} catch {
|
|
307
|
+
} catch (e) {
|
|
294
308
|
}
|
|
295
309
|
this.emit(eventName, data);
|
|
296
310
|
eventName = "message";
|
|
@@ -314,6 +328,9 @@ var SSEClient = class extends EventEmitter {
|
|
|
314
328
|
function isWindows() {
|
|
315
329
|
return os.platform() === "win32";
|
|
316
330
|
}
|
|
331
|
+
function typedSystemArch() {
|
|
332
|
+
return os.arch();
|
|
333
|
+
}
|
|
317
334
|
function chmodPlusX(filePath) {
|
|
318
335
|
if (os.platform() === "win32") {
|
|
319
336
|
return;
|
|
@@ -409,5 +426,6 @@ export {
|
|
|
409
426
|
createTempDir,
|
|
410
427
|
createTempFilePath,
|
|
411
428
|
isWindows,
|
|
412
|
-
throwIfDirNotEmpty
|
|
429
|
+
throwIfDirNotEmpty,
|
|
430
|
+
typedSystemArch
|
|
413
431
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rg-dev/stdlib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
-
"build": "tsup"
|
|
7
|
+
"build": "tsup && node after-build.mjs"
|
|
8
8
|
},
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
package/lib/index.cjs
DELETED
|
File without changes
|
package/lib/index.js
DELETED
|
File without changes
|