@gjsify/utils 0.0.2 → 0.0.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/lib/cjs/cancel-handler.js +5 -24
- package/lib/cjs/cli.js +5 -34
- package/lib/cjs/error.js +3 -22
- package/lib/cjs/file.js +5 -34
- package/lib/cjs/fs.js +7 -36
- package/lib/cjs/index.js +14 -30
- package/lib/cjs/log.js +23 -52
- package/lib/cjs/message.js +4 -23
- package/lib/cjs/os.js +15 -44
- package/lib/cjs/path.js +13 -42
- package/lib/cjs/process.js +12 -41
- package/lib/cjs/system.js +11 -41
- package/lib/cjs/tty.js +8 -27
- package/lib/cjs/types/cancel-signals.js +0 -15
- package/lib/cjs/types/error-data.js +0 -15
- package/lib/cjs/types/index.js +8 -24
- package/lib/cjs/types/signal-methods.js +0 -15
- package/lib/cjs/types/stack-trace-frame.js +0 -15
- package/lib/cjs/types/structured-log-data.js +0 -15
- package/lib/cjs/types/uncaught-exception-data.js +0 -15
- package/lib/cjs/types/unhandled-rejection-data.js +0 -15
- package/lib/cjs/types/user-info.js +0 -15
- package/lib/cjs/version.js +3 -22
- package/package.json +6 -6
- package/test.gjs.js +524 -559
- package/tsconfig.json +1 -1
- package/tsconfig.types.tsbuildinfo +1 -1
package/lib/cjs/system.js
CHANGED
|
@@ -1,53 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var system_exports = {};
|
|
29
|
-
__export(system_exports, {
|
|
30
|
-
getArgs: () => getArgs,
|
|
31
|
-
getArgv: () => getArgv,
|
|
32
|
-
parseArgv: () => parseArgv
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(system_exports);
|
|
35
|
-
var import_glib_2 = __toESM(require("@girs/glib-2.0"), 1);
|
|
36
|
-
var import_gio_2 = __toESM(require("@girs/gio-2.0"), 1);
|
|
37
|
-
var import_fs = require("./fs.js");
|
|
38
|
-
const import_meta = {};
|
|
39
|
-
const File = import_gio_2.default.File;
|
|
1
|
+
import GLib from "@girs/glib-2.0";
|
|
2
|
+
import Gio from "@girs/gio-2.0";
|
|
3
|
+
import { existsSync } from "./fs.js";
|
|
4
|
+
const File = Gio.File;
|
|
40
5
|
const args = [];
|
|
41
6
|
const getArgv = () => {
|
|
42
7
|
if (args.length) {
|
|
43
8
|
return args;
|
|
44
9
|
}
|
|
45
|
-
const [__filename] =
|
|
10
|
+
const [__filename] = GLib.filename_from_uri(import.meta.url);
|
|
46
11
|
args.push(__filename);
|
|
47
12
|
ARGV.forEach((arg) => {
|
|
48
13
|
if (arg[0] !== "-") {
|
|
49
14
|
args.push(
|
|
50
|
-
|
|
15
|
+
existsSync(arg) ? File.new_for_path(arg).get_path() : arg
|
|
51
16
|
);
|
|
52
17
|
} else {
|
|
53
18
|
args.push(arg);
|
|
@@ -75,3 +40,8 @@ const parseArgv = (argv) => {
|
|
|
75
40
|
}
|
|
76
41
|
return result;
|
|
77
42
|
};
|
|
43
|
+
export {
|
|
44
|
+
getArgs,
|
|
45
|
+
getArgv,
|
|
46
|
+
parseArgv
|
|
47
|
+
};
|
package/lib/cjs/tty.js
CHANGED
|
@@ -1,32 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var tty_exports = {};
|
|
19
|
-
__export(tty_exports, {
|
|
20
|
-
STDERR_FD: () => STDERR_FD,
|
|
21
|
-
STDIN_FD: () => STDIN_FD,
|
|
22
|
-
STDOUT_FD: () => STDOUT_FD,
|
|
23
|
-
existsTty: () => existsTty
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(tty_exports);
|
|
26
|
-
var import_fs = require("./fs.js");
|
|
1
|
+
import { existsFD } from "./fs.js";
|
|
27
2
|
const STDIN_FD = 0;
|
|
28
3
|
const STDOUT_FD = 1;
|
|
29
4
|
const STDERR_FD = 2;
|
|
30
5
|
const existsTty = () => {
|
|
31
|
-
return
|
|
6
|
+
return existsFD(STDOUT_FD);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
STDERR_FD,
|
|
10
|
+
STDIN_FD,
|
|
11
|
+
STDOUT_FD,
|
|
12
|
+
existsTty
|
|
32
13
|
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var cancel_signals_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(cancel_signals_exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var error_data_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(error_data_exports);
|
package/lib/cjs/types/index.js
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
var types_exports = {};
|
|
16
|
-
module.exports = __toCommonJS(types_exports);
|
|
17
|
-
__reExport(types_exports, require("./cancel-signals.js"), module.exports);
|
|
18
|
-
__reExport(types_exports, require("./error-data.js"), module.exports);
|
|
19
|
-
__reExport(types_exports, require("./signal-methods.js"), module.exports);
|
|
20
|
-
__reExport(types_exports, require("./stack-trace-frame.js"), module.exports);
|
|
21
|
-
__reExport(types_exports, require("./structured-log-data.js"), module.exports);
|
|
22
|
-
__reExport(types_exports, require("./uncaught-exception-data.js"), module.exports);
|
|
23
|
-
__reExport(types_exports, require("./unhandled-rejection-data.js"), module.exports);
|
|
24
|
-
__reExport(types_exports, require("./user-info.js"), module.exports);
|
|
1
|
+
export * from "./cancel-signals.js";
|
|
2
|
+
export * from "./error-data.js";
|
|
3
|
+
export * from "./signal-methods.js";
|
|
4
|
+
export * from "./stack-trace-frame.js";
|
|
5
|
+
export * from "./structured-log-data.js";
|
|
6
|
+
export * from "./uncaught-exception-data.js";
|
|
7
|
+
export * from "./unhandled-rejection-data.js";
|
|
8
|
+
export * from "./user-info.js";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var signal_methods_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(signal_methods_exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var stack_trace_frame_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(stack_trace_frame_exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var structured_log_data_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(structured_log_data_exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var uncaught_exception_data_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(uncaught_exception_data_exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var unhandled_rejection_data_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(unhandled_rejection_data_exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var user_info_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(user_info_exports);
|
package/lib/cjs/version.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var version_exports = {};
|
|
19
|
-
__export(version_exports, {
|
|
20
|
-
getGjsVersion: () => getGjsVersion
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(version_exports);
|
|
23
1
|
const getGjsVersion = () => {
|
|
24
2
|
const v = imports.system.version.toString();
|
|
25
3
|
return `${v[0]}.${+(v[1] + v[2])}.${+(v[3] + v[4])}`;
|
|
26
4
|
};
|
|
5
|
+
export {
|
|
6
|
+
getGjsVersion
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Utils module for gjsify",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"fs"
|
|
36
36
|
],
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@gjsify/cli": "^0.0.
|
|
39
|
-
"typescript": "^5.
|
|
38
|
+
"@gjsify/cli": "^0.0.4",
|
|
39
|
+
"typescript": "^5.3.3"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@girs/gio-2.0": "2.
|
|
43
|
-
"@girs/gjs": "^3.
|
|
44
|
-
"@girs/glib-2.0": "2.
|
|
42
|
+
"@girs/gio-2.0": "2.78.0-3.2.6",
|
|
43
|
+
"@girs/gjs": "^3.2.6",
|
|
44
|
+
"@girs/glib-2.0": "2.78.0-3.2.6"
|
|
45
45
|
}
|
|
46
46
|
}
|