@zwa73/utils 1.0.263 → 1.0.265

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.
@@ -42,8 +42,10 @@ declare class _UtilFunc {
42
42
  stdout: string;
43
43
  stderr: string;
44
44
  }>;
45
- /**获取当前公网ipv4 */
46
- static getPublicIpv4(): Promise<string>;
45
+ /**获取当前公网ipv4
46
+ * 依赖于 public-ip@6.0.2 但不会自动安装
47
+ */
48
+ static getPublicIpv4(): Promise<string | undefined>;
47
49
  }
48
50
  export declare const UtilFunc: import("@zwa73/modular-mixer").ComposedClass<typeof _UtilFunc, typeof JsFunc, "__jsUtils", "match" | "failed" | "success" | "prototype" | "genUUID" | "range" | "preset" | "assignOption" | "getTime" | "initField" | "initObject" | "afterward" | "sleep" | "getNeverResolvedPromise" | "retryPromise" | "timelimitPromise" | "mapEntries" | "eachField" | "stringifyJToken" | "sortJToken" | "assertType" | "assertLiteral" | "deepClone" | "isSafeNumber" | "dedent" | "throwError" | "getFuncLoc" | "cachePool" | "memoize" | "asyncize" | "lazyFunction" | "splitToChunk" | "mergeFromChunk" | "structEqual" | "concurrent" | "dynamicImport" | "createInjectable" | "createAsyncProxy" | "checkSharpSchema" | "outcome" | "extractOutcome" | "isStatus" | "eitherize" | "parseSrtTime" | "formatSrtTime" | "parseSrt" | "createSrt" | "ivk" | "s2l" | "l2s">;
49
51
  export type UtilFunc = typeof UtilFunc;
@@ -116,11 +116,17 @@ class _UtilFunc {
116
116
  });
117
117
  });
118
118
  }
119
- /**获取当前公网ipv4 */
119
+ /**获取当前公网ipv4
120
+ * 依赖于 public-ip@6.0.2 但不会自动安装
121
+ */
120
122
  static async getPublicIpv4() {
121
123
  const pip = await js_utils_1.JsFunc.dynamicImport('public-ip');
122
124
  //if(_UtilFunc.publicIp===undefined)
123
125
  // _UtilFunc.publicIp = await import("public-ip");
126
+ if (pip == undefined) {
127
+ UtilLogger_1.SLogger.warn(`npm包 public-ip 动态导入失败, 可能是未安装, 可使用 npm i public-ip@6.0.2 来安装`);
128
+ return undefined;
129
+ }
124
130
  return pip.publicIpv4();
125
131
  }
126
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.263",
3
+ "version": "1.0.265",
4
4
  "description": "my utils",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -16,7 +16,6 @@
16
16
  "author": "zwa73",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
- "@deepkit/type": "^1.0.1-alpha.153",
20
19
  "@zwa73/js-utils": "*",
21
20
  "@zwa73/modular-mixer": "^1.0.8",
22
21
  "form-data": "^4.0.2",
@@ -27,16 +26,17 @@
27
26
  "https-proxy-agent": "^5.0.1",
28
27
  "json5": "^2.2.3",
29
28
  "pathe": "^1.1.2",
30
- "public-ip": "^6.0.2",
31
29
  "querystring": "^0.2.1",
32
30
  "tiktoken": "^1.0.7",
33
31
  "winston": "^3.10.0",
34
32
  "winston-daily-rotate-file": "^4.7.1"
35
33
  },
36
34
  "devDependencies": {
35
+ "@deepkit/type": "^1.0.1-alpha.153",
37
36
  "@types/jest": "^29.5.12",
38
37
  "@types/node": "^20.14.11",
39
38
  "@zwa73/dev-utils": "*",
39
+ "public-ip": "^6.0.2",
40
40
  "tsc-alias": "^1.8.8",
41
41
  "typescript": "^5.3.3"
42
42
  },