hunter-open-sdk 1.1.2 → 2.0.0-beta.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 CHANGED
@@ -1,2 +1,7 @@
1
1
  采货侠SaaS版本桌面端sdk
2
2
 
3
+ # 发包命令
4
+ 发测试包
5
+ ```
6
+ npm publish --tag=beta
7
+ ```
@@ -216,7 +216,7 @@ var writeDllVersion = function writeDllVersion(version) {
216
216
  }
217
217
  console.log('========写入version成功');
218
218
  // 写入成功后 重新初始化dll
219
- (0, _utils3.HunterInspectionKit)();
219
+ (0, _utils3.initHunterInspectionKit)();
220
220
  saasCallBack({
221
221
  data: {
222
222
  eventName: 'type_update_result',
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.1.0
@@ -73,7 +73,7 @@ var deleteGlobalProperty = exports.deleteGlobalProperty = function deleteGlobalP
73
73
  var getHunterInspectionKit = exports.getHunterInspectionKit = function getHunterInspectionKit(willInit) {
74
74
  var kit = getGlobalProperty('HunterInspectionKit');
75
75
  if (!kit) {
76
- !willInit && console.warn('HunterInspectionKit未初始化,请先调用HunterInspectionKit()函数');
76
+ !willInit && console.warn('HunterInspectionKit未初始化,请先调用 initHunterInspectionKit() 函数');
77
77
  return null;
78
78
  }
79
79
  return kit;
@@ -88,7 +88,7 @@ var getHunterInspectionKit = exports.getHunterInspectionKit = function getHunter
88
88
  var callHunterInspectionKit = exports.callHunterInspectionKit = function callHunterInspectionKit(methodName) {
89
89
  var kit = getHunterInspectionKit(true);
90
90
  if (!kit) {
91
- (0, _utils.HunterInspectionKit)();
91
+ (0, _utils.initHunterInspectionKit)();
92
92
  kit = getHunterInspectionKit(false);
93
93
  }
94
94
  if (!kit || typeof kit[methodName] !== 'function') {
@@ -1,45 +1,47 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.HunterInspectionKit = void 0;
7
+ exports.initHunterInspectionKit = void 0;
8
+ var _koffi = _interopRequireDefault(require("koffi"));
9
+ var _path = _interopRequireDefault(require("path"));
10
+ var _fs = _interopRequireDefault(require("fs"));
7
11
  var _utils = require("./utils");
8
12
  var _utils2 = require("./utils.global");
9
- var ffi = require('ffi-napi');
10
- var path = require('path');
11
- var fs = require('fs');
12
-
13
13
  /**
14
14
  * 声明dll函数
15
15
  * @param {String} udid 设备id
16
16
  * @returns
17
17
  */
18
18
 
19
- var HunterInspectionKit = exports.HunterInspectionKit = function HunterInspectionKit() {
19
+ var initHunterInspectionKit = exports.initHunterInspectionKit = function initHunterInspectionKit() {
20
20
  var dllPath;
21
21
 
22
22
  // 读取本地sdk的version
23
- var versionPath = path.resolve(__dirname, '../resources/version.online');
24
- var version = fs.readFileSync(versionPath, 'utf-8');
23
+ var versionPath = _path.default.resolve(__dirname, '../resources/version.online');
24
+ var version = _fs.default.readFileSync(versionPath, 'utf-8');
25
25
  if ((0, _utils.isMac)()) {
26
26
  if ((0, _utils.isArm64)()) {
27
- dllPath = path.resolve(__dirname, "../resources/mac/libinspectionkit_arm64_".concat(version, ".dylib"));
27
+ dllPath = _path.default.resolve(__dirname, "../resources/mac/libinspectionkit_arm64_".concat(version, ".dylib"));
28
28
  }
29
29
  if ((0, _utils.isAmd64)()) {
30
- dllPath = path.resolve(__dirname, "../resources/mac/libinspectionkit_amd64_".concat(version, ".dylib"));
30
+ dllPath = _path.default.resolve(__dirname, "../resources/mac/libinspectionkit_amd64_".concat(version, ".dylib"));
31
31
  }
32
32
  } else {
33
- dllPath = path.resolve(__dirname, "../resources/dll/libinspectionkit_x64_".concat(version, ".dll"));
33
+ dllPath = _path.default.resolve(__dirname, "../resources/dll/libinspectionkit_x64_".concat(version, ".dll"));
34
34
  }
35
35
  if (!(0, _utils.isDev)()) {
36
36
  // 如果是生产模式 则替换app.asar 路径 为了在生产调用dll
37
37
  dllPath = dllPath.replace('app.asar', 'app.asar.unpacked');
38
38
  }
39
- var kitFn = new ffi.Library(dllPath, {
40
- 'InspectionKit': ['string', ['string', 'string', 'string']],
41
- 'TheForceKit': ['string', ['string']]
42
- });
39
+ var dllLib = _koffi.default.load(dllPath);
40
+ var dllKit = {
41
+ InspectionKit: dllLib.func('InspectionKit', 'str', ['str', 'str', 'str']),
42
+ TheForceKit: dllLib.func('TheForceKit', 'str', ['str'])
43
+ };
44
+
43
45
  // 挂载到全局对象,兼容主进程和渲染进程
44
- (0, _utils2.setGlobalProperty)('HunterInspectionKit', kitFn);
46
+ (0, _utils2.setGlobalProperty)('HunterInspectionKit', dllKit);
45
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hunter-open-sdk",
3
- "version": "1.1.2",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "采货侠SaaS版本桌面端sdk",
5
5
  "scripts": {
6
6
  "start": "zz dev",
@@ -29,9 +29,9 @@
29
29
  "@sentry/browser": "^10.10.0",
30
30
  "compressing": "2.0.0",
31
31
  "core-js": "3.6.5",
32
- "ffi-napi": "^4.0.3",
33
32
  "fs": "^0.0.1-security",
34
33
  "fs-extra": "^11.3.0",
34
+ "koffi": "2.14.1",
35
35
  "lodash": "4.17.21",
36
36
  "request": "^2.88.2",
37
37
  "sudo-prompt": "^9.2.1",
@@ -45,13 +45,13 @@
45
45
  "@evilmartians/lefthook": "0.8.0",
46
46
  "@types/lodash": "4.14.182",
47
47
  "@umijs/fabric": "2.12.2",
48
- "@zz-common/bunlder-module-father": "^0.0.10",
48
+ "@zz-common/bunlder-module-father": "0.0.11",
49
49
  "@zz-common/dev-standard": "^2.0.8",
50
- "@zz-common/zz-cli": "^5.0.3",
51
- "@zz-common/zz-cli-types": "^0.0.9",
50
+ "@zz-common/zz-cli": "5.0.6",
51
+ "@zz-common/zz-cli-types": "0.0.15",
52
52
  "commitizen": "4.2.5",
53
53
  "commitlint": "17.0.2",
54
- "father": "4.1.6",
54
+ "father": "4.6.7",
55
55
  "lint-staged": "10.0.8",
56
56
  "path-to-regexp": "2.4.0",
57
57
  "typedoc": "0.23.9",
@@ -65,5 +65,8 @@
65
65
  "files": [
66
66
  "lib",
67
67
  "es"
68
- ]
68
+ ],
69
+ "engines": {
70
+ "node": ">=20.0.0"
71
+ }
69
72
  }