@gjsify/net 0.0.2 → 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.
Files changed (2) hide show
  1. package/lib/cjs/index.js +10 -39
  2. package/package.json +6 -6
package/lib/cjs/index.js CHANGED
@@ -1,49 +1,15 @@
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 __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 src_exports = {};
29
- __export(src_exports, {
30
- isIP: () => isIP,
31
- isIPv4: () => isIPv4,
32
- isIPv6: () => isIPv6
33
- });
34
- module.exports = __toCommonJS(src_exports);
35
- var import_gio_2 = __toESM(require("@girs/gio-2.0"), 1);
1
+ import Gio from "@girs/gio-2.0";
36
2
  function isIP(input) {
37
- const addr = import_gio_2.default.InetAddress.new_from_string(input);
3
+ const addr = Gio.InetAddress.new_from_string(input);
38
4
  if (!addr)
39
5
  return 0;
40
6
  const family = addr.get_family();
41
7
  switch (family) {
42
- case import_gio_2.default.SocketFamily.INVALID:
8
+ case Gio.SocketFamily.INVALID:
43
9
  return 0;
44
- case import_gio_2.default.SocketFamily.IPV4:
10
+ case Gio.SocketFamily.IPV4:
45
11
  return 4;
46
- case import_gio_2.default.SocketFamily.IPV6:
12
+ case Gio.SocketFamily.IPV6:
47
13
  return 6;
48
14
  }
49
15
  }
@@ -53,3 +19,8 @@ function isIPv4(input) {
53
19
  function isIPv6(input) {
54
20
  return isIP(input) === 6;
55
21
  }
22
+ export {
23
+ isIP,
24
+ isIPv4,
25
+ isIPv6
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/net",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Node.js net module for Gjs",
5
5
  "type": "module",
6
6
  "main": "lib/cjs/index.js",
@@ -36,11 +36,11 @@
36
36
  "net"
37
37
  ],
38
38
  "devDependencies": {
39
- "@gjsify/assert": "^0.0.2",
40
- "@gjsify/cli": "^0.0.2",
41
- "@gjsify/esbuild-plugin-gjsify": "^0.0.2",
42
- "@gjsify/process": "^0.0.2",
43
- "@gjsify/unit": "^0.0.2",
39
+ "@gjsify/assert": "^0.0.3",
40
+ "@gjsify/cli": "^0.0.3",
41
+ "@gjsify/esbuild-plugin-gjsify": "^0.0.3",
42
+ "@gjsify/process": "^0.0.3",
43
+ "@gjsify/unit": "^0.0.3",
44
44
  "@types/node": "^20.3.1"
45
45
  },
46
46
  "dependencies": {