@gjsify/process 0.0.1 → 0.0.2
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/README.md +8 -18
- package/lib/cjs/index.js +36 -0
- package/lib/esm/index.js +6 -0
- package/lib/types/index.d.ts +3 -0
- package/package.json +37 -17
- package/src/index.spec.ts +28 -0
- package/src/index.ts +3 -0
- package/src/test.mts +4 -0
- package/test.gjs.mjs +34721 -0
- package/test.gjs.mjs.meta.json +1 -0
- package/test.node.mjs +308 -0
- package/tsconfig.json +19 -0
- package/tsconfig.types.json +8 -0
- package/tsconfig.types.tsbuildinfo +1 -0
- package/index.js +0 -94
- package/test/index.js +0 -20
package/README.md
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
# @gjsify/process
|
|
1
|
+
# @gjsify/process
|
|
2
2
|
|
|
3
|
-
process
|
|
3
|
+
Node.js process module for Gjs
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* `cwd()`
|
|
12
|
-
* `env`
|
|
13
|
-
* `exit([code])`
|
|
14
|
-
* `nexttick(callback[, ...args])`, via `setImmediate(...)`
|
|
15
|
-
* `pid`, via `new Gio.Credentials().get_unix_pid()`. Not sure yet it works for macOS
|
|
16
|
-
* `platform`, via `require('os').platform()`
|
|
17
|
-
* `title`, via `GLib.get_prgname()`
|
|
18
|
-
* `version`, via cgjs `package.json` version
|
|
19
|
-
* `uptime`, via `Date.now() - START_TIME`
|
|
20
|
-
* `versions()`, via cgjs `package.json` dependencies
|
|
5
|
+
## Inspirations and credits
|
|
6
|
+
- https://github.com/cgjs/cgjs/tree/master/packages/process
|
|
7
|
+
- https://github.com/denoland/deno_std/blob/main/node/process.ts
|
|
8
|
+
- https://github.com/geut/brode/blob/main/packages/browser-node-core/src/process.js
|
|
9
|
+
- https://github.com/aleclarson/process-browserify
|
|
10
|
+
- https://github.com/defunctzombie/node-process
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => src_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
__reExport(src_exports, require("@gjsify/deno_std/node/process"), module.exports);
|
|
35
|
+
var import_process = __toESM(require("@gjsify/deno_std/node/process"), 1);
|
|
36
|
+
var src_default = import_process.default;
|
package/lib/esm/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/process",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "process
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Node.js process module for Gjs",
|
|
5
|
+
"main": "lib/cjs/index.js",
|
|
6
|
+
"module": "lib/esm/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"default": "./lib/esm/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./lib/types/index.d.ts",
|
|
17
|
+
"default": "./lib/cjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
5
21
|
"scripts": {
|
|
6
|
-
"
|
|
22
|
+
"clear": "rm -rf lib tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs",
|
|
23
|
+
"print:name": "echo '@gjsify/process'",
|
|
24
|
+
"build": "yarn print:name && yarn build:gjsify && yarn build:types",
|
|
25
|
+
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
|
|
26
|
+
"build:types": "tsc --project tsconfig.types.json || exit 0",
|
|
27
|
+
"build:test": "yarn build:test:gjs && yarn build:test:node",
|
|
28
|
+
"build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
|
|
29
|
+
"build:test:node": "gjsify build src/test.mts --app node --outfile test.node.mjs",
|
|
30
|
+
"test": "yarn print:name && yarn build:gjsify && yarn build:test && yarn test:node && yarn test:gjs",
|
|
31
|
+
"test:gjs": "gjs -m test.gjs.mjs",
|
|
32
|
+
"test:node": "node test.node.mjs"
|
|
7
33
|
},
|
|
8
34
|
"keywords": [
|
|
9
35
|
"gjs",
|
|
10
|
-
"require",
|
|
11
|
-
"commonjs",
|
|
12
|
-
"npm",
|
|
13
36
|
"node",
|
|
14
|
-
"gtk",
|
|
15
|
-
"native",
|
|
16
|
-
"cgjs",
|
|
17
37
|
"process"
|
|
18
38
|
],
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"bugs": "https://github.com/cgjs/cgjs/issues",
|
|
24
|
-
"homepage": "https://github.com/cgjs/cgjs/tree/master/packages/process#readme",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@girs/gjs": "^3.1.0",
|
|
41
|
+
"@gjsify/utils": "^0.0.2"
|
|
42
|
+
},
|
|
25
43
|
"devDependencies": {
|
|
26
|
-
"
|
|
44
|
+
"@gjsify/cli": "^0.0.2",
|
|
45
|
+
"@types/node": "^20.3.1",
|
|
46
|
+
"typescript": "^5.1.3"
|
|
27
47
|
}
|
|
28
|
-
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, it, expect } from '@gjsify/unit'
|
|
2
|
+
|
|
3
|
+
import process from 'process';
|
|
4
|
+
|
|
5
|
+
// process.on('exit', code => console.log('bye bye: ' + code));
|
|
6
|
+
|
|
7
|
+
// Object.keys(process).forEach(key => {
|
|
8
|
+
// switch (key) {
|
|
9
|
+
// case 'abort':
|
|
10
|
+
// case 'env':
|
|
11
|
+
// case 'exit':
|
|
12
|
+
// case 'nextTick':
|
|
13
|
+
// return;
|
|
14
|
+
// }
|
|
15
|
+
// console.log(key, typeof process[key] === 'function' ? process[key]() : process[key]);
|
|
16
|
+
// });
|
|
17
|
+
|
|
18
|
+
// process.nextTick(process.exit, 0);
|
|
19
|
+
|
|
20
|
+
// assert.deepEqual(process.argv.splice(2), ["--foo", "bar"]);
|
|
21
|
+
|
|
22
|
+
export default async () => {
|
|
23
|
+
await describe("Progress", async () => {
|
|
24
|
+
await it("process.arch should be a string", async () => {
|
|
25
|
+
await expect(typeof process.arch).toBe("string");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
};
|
package/src/index.ts
ADDED
package/src/test.mts
ADDED