@gjsify/process 0.0.1 → 0.0.3

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 CHANGED
@@ -1,20 +1,10 @@
1
- # @gjsify/process [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg)](https://opensource.org/licenses/ISC)
1
+ # @gjsify/process
2
2
 
3
- process core module for [gjs](https://gitlab.gnome.org/GNOME/gjs) forked from [@cgjs/process](https://github.com/cgjs/cgjs/tree/master/packages/process)
3
+ Node.js process module for Gjs
4
4
 
5
- ### Currently usable
6
-
7
- * `abort()`
8
- * `arch`, via `require('os').arch()`
9
- * `argv`
10
- * `argv0`
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
@@ -0,0 +1,6 @@
1
+ export * from "@gjsify/deno_std/node/process";
2
+ import process from "@gjsify/deno_std/node/process";
3
+ var src_default = process;
4
+ export {
5
+ src_default as default
6
+ };
@@ -0,0 +1,6 @@
1
+ export * from "@gjsify/deno_std/node/process";
2
+ import process from "@gjsify/deno_std/node/process";
3
+ var src_default = process;
4
+ export {
5
+ src_default as default
6
+ };
@@ -0,0 +1,3 @@
1
+ export * from '@gjsify/deno_std/node/process';
2
+ import process from '@gjsify/deno_std/node/process';
3
+ export default process;
package/package.json CHANGED
@@ -1,28 +1,48 @@
1
1
  {
2
2
  "name": "@gjsify/process",
3
- "version": "0.0.1",
4
- "description": "process core module for gjs",
3
+ "version": "0.0.3",
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
- "test": "cgjs ./test --foo bar"
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
- "author": "Andrea Giammarchi",
20
- "license": "ISC",
21
- "main": "index.js",
22
- "repository": "github:cgjs/cgjs",
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.3"
42
+ },
25
43
  "devDependencies": {
26
- "cgjs": "^0.1.28"
44
+ "@gjsify/cli": "^0.0.3",
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
@@ -0,0 +1,3 @@
1
+ export * from '@gjsify/deno_std/node/process';
2
+ import process from '@gjsify/deno_std/node/process';
3
+ export default process;
package/src/test.mts ADDED
@@ -0,0 +1,4 @@
1
+
2
+ import { run } from '@gjsify/unit';
3
+ import testSuite from './index.spec.js';
4
+ run({testSuite});