@onekeyfe/react-native-sni-connect 1.1.0 → 3.0.70

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-sni-connect",
3
- "version": "1.1.0",
3
+ "version": "3.0.70",
4
4
  "description": "A React Native library for SNI-based HTTP requests with DNS caching and request management",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -17,9 +17,7 @@
17
17
  "lib",
18
18
  "android",
19
19
  "ios",
20
- "cpp",
21
20
  "*.podspec",
22
- "react-native.config.js",
23
21
  "!ios/build",
24
22
  "!android/build",
25
23
  "!android/gradle",
@@ -29,22 +27,16 @@
29
27
  "!**/__tests__",
30
28
  "!**/__fixtures__",
31
29
  "!**/__mocks__",
32
- "!**/.*"
30
+ "!**/.*",
31
+ "!**/*.map"
33
32
  ],
34
33
  "scripts": {
35
- "example": "yarn workspace react-native-sni-connect-example",
36
- "test": "jest",
37
- "typecheck": "tsc",
38
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
34
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
35
  "prepare": "bob build",
41
- "update-version": "release-it --ci --no-npm.publish --no-github.release --no-git.commit --no-git.tag --no-git.push",
42
- "update-version:patch": "release-it patch --ci --no-npm.publish --no-github.release --no-git.commit --no-git.tag --no-git.push",
43
- "update-version:minor": "release-it minor --ci --no-npm.publish --no-github.release --no-git.commit --no-git.tag --no-git.push",
44
- "update-version:major": "release-it major --ci --no-npm.publish --no-github.release --no-git.commit --no-git.tag --no-git.push",
45
- "release": "release-it --only-version",
46
- "prepack": "yarn clean && yarn prepare",
47
- "prepublish": "yarn typecheck && yarn lint"
36
+ "typecheck": "tsc",
37
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
38
+ "test": "jest",
39
+ "release": "yarn prepare && npm whoami && npm publish --access public"
48
40
  },
49
41
  "keywords": [
50
42
  "react-native",
@@ -53,36 +45,38 @@
53
45
  ],
54
46
  "repository": {
55
47
  "type": "git",
56
- "url": "git+https://github.com/OneKeyHQ/react-native-sni-connect.git"
48
+ "url": "git+https://github.com/OneKeyHQ/app-modules/react-native-sni-connect.git"
57
49
  },
58
- "author": "OneKey <hi@onekey.so> (https://github.com/OneKeyHQ)",
50
+ "author": "@onekeyhq <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
59
51
  "license": "MIT",
60
52
  "bugs": {
61
- "url": "https://github.com/OneKeyHQ/react-native-sni-connect/issues"
53
+ "url": "https://github.com/OneKeyHQ/app-modules/react-native-sni-connect/issues"
62
54
  },
63
- "homepage": "https://github.com/OneKeyHQ/react-native-sni-connect#readme",
55
+ "homepage": "https://github.com/OneKeyHQ/app-modules/react-native-sni-connect#readme",
64
56
  "publishConfig": {
65
57
  "registry": "https://registry.npmjs.org/"
66
58
  },
67
59
  "devDependencies": {
68
60
  "@commitlint/config-conventional": "^19.8.1",
69
- "@evilmartians/lefthook": "^1.12.3",
70
- "@react-native-community/cli": "20.0.1",
71
- "@react-native/babel-preset": "0.81.1",
72
- "@react-native/eslint-config": "^0.81.1",
61
+ "@eslint/compat": "^1.3.2",
62
+ "@eslint/eslintrc": "^3.3.1",
63
+ "@eslint/js": "^9.35.0",
64
+ "@react-native/babel-preset": "0.83.0",
65
+ "@react-native/eslint-config": "0.83.0",
73
66
  "@release-it/conventional-changelog": "^10.0.1",
74
67
  "@types/jest": "^29.5.14",
75
- "@types/react": "^19.1.0",
68
+ "@types/react": "^19.2.0",
76
69
  "commitlint": "^19.8.1",
77
70
  "del-cli": "^6.0.0",
78
- "eslint": "^8.57.0",
71
+ "eslint": "^9.35.0",
79
72
  "eslint-config-prettier": "^10.1.8",
80
73
  "eslint-plugin-prettier": "^5.5.4",
81
74
  "jest": "^29.7.0",
82
- "prettier": "^3.6.2",
83
- "react": "19.1.0",
84
- "react-native": "0.81.1",
85
- "react-native-builder-bob": "^0.40.13",
75
+ "lefthook": "^2.0.3",
76
+ "prettier": "^2.8.8",
77
+ "react": "19.2.0",
78
+ "react-native": "patch:react-native@npm%3A0.83.0#~/.yarn/patches/react-native-npm-0.83.0-577d0f2d83.patch",
79
+ "react-native-builder-bob": "^0.40.17",
86
80
  "release-it": "^19.0.4",
87
81
  "turbo": "^2.5.6",
88
82
  "typescript": "^5.9.2"
@@ -91,10 +85,39 @@
91
85
  "react": "*",
92
86
  "react-native": "*"
93
87
  },
94
- "workspaces": [
95
- "example"
96
- ],
97
- "packageManager": "yarn@3.6.1",
88
+ "react-native-builder-bob": {
89
+ "source": "src",
90
+ "output": "lib",
91
+ "targets": [
92
+ [
93
+ "module",
94
+ {
95
+ "esm": true
96
+ }
97
+ ],
98
+ [
99
+ "typescript",
100
+ {
101
+ "project": "tsconfig.build.json"
102
+ }
103
+ ]
104
+ ]
105
+ },
106
+ "codegenConfig": {
107
+ "name": "SniConnectSpec",
108
+ "type": "modules",
109
+ "jsSrcsDir": "src",
110
+ "android": {
111
+ "javaPackageName": "com.sniconnect"
112
+ }
113
+ },
114
+ "prettier": {
115
+ "quoteProps": "consistent",
116
+ "singleQuote": true,
117
+ "tabWidth": 2,
118
+ "trailingComma": "es5",
119
+ "useTabs": false
120
+ },
98
121
  "jest": {
99
122
  "preset": "react-native",
100
123
  "modulePathIgnorePatterns": [
@@ -126,39 +149,6 @@
126
149
  }
127
150
  }
128
151
  },
129
- "prettier": {
130
- "quoteProps": "consistent",
131
- "singleQuote": true,
132
- "tabWidth": 2,
133
- "trailingComma": "es5",
134
- "useTabs": false
135
- },
136
- "react-native-builder-bob": {
137
- "source": "src",
138
- "output": "lib",
139
- "targets": [
140
- [
141
- "module",
142
- {
143
- "esm": true
144
- }
145
- ],
146
- [
147
- "typescript",
148
- {
149
- "project": "tsconfig.build.json"
150
- }
151
- ]
152
- ]
153
- },
154
- "codegenConfig": {
155
- "name": "SniConnectSpec",
156
- "type": "modules",
157
- "jsSrcsDir": "src",
158
- "android": {
159
- "javaPackageName": "com.sniconnect"
160
- }
161
- },
162
152
  "create-react-native-library": {
163
153
  "languages": "kotlin-objc",
164
154
  "type": "turbo-module",
@@ -33,10 +33,6 @@ export interface Spec extends TurboModule {
33
33
  cancelRequest(requestId: string): Promise<{ success: boolean }>;
34
34
  cancelAllRequests(): Promise<{ success: boolean }>;
35
35
  clearDNSCache(): Promise<{ success: boolean }>;
36
-
37
- // Event emitter methods required for NativeEventEmitter
38
- addListener(eventType: string): void;
39
- removeListeners(count: Int32): void;
40
36
  }
41
37
 
42
38
  const LINKING_ERROR =
@@ -45,12 +41,7 @@ const LINKING_ERROR =
45
41
  '- You rebuilt the app after installing the package\n' +
46
42
  '- You are not using Expo Go; create a custom dev client instead\n';
47
43
 
48
- export type SniConnectModule = Spec & {
49
- request(config: SniConnectRequest): Promise<SniConnectResponse>;
50
- cancelRequest(requestId: string): Promise<{ success: boolean }>;
51
- cancelAllRequests(): Promise<{ success: boolean }>;
52
- clearDNSCache(): Promise<{ success: boolean }>;
53
- };
44
+ export type SniConnectModule = Spec;
54
45
 
55
46
  const turboModuleResult = TurboModuleRegistry.get<Spec>('SniConnect');
56
47
 
package/src/index.tsx CHANGED
@@ -1,28 +1,8 @@
1
- import { NativeEventEmitter } from 'react-native';
2
1
  import NativeSniConnect, {
3
2
  type SniConnectRequest,
4
3
  type SniConnectResponse,
5
4
  } from './NativeSniConnect';
6
5
 
7
- // Log entry type definition
8
- export type LogEntry = {
9
- level: string;
10
- message: string;
11
- timestamp: number;
12
- };
13
-
14
- // Create event emitter instance
15
- const eventEmitter = new NativeEventEmitter(NativeSniConnect as any);
16
-
17
- // Simple log subscription function
18
- export function subscribeToLogs(callback: (log: LogEntry) => void): () => void {
19
- const subscription = eventEmitter.addListener('SniConnectLog', (log: any) => {
20
- // Type assertion since we know the structure
21
- callback(log as LogEntry);
22
- });
23
- return () => subscription.remove();
24
- }
25
-
26
6
  export function request(
27
7
  config: SniConnectRequest
28
8
  ): Promise<SniConnectResponse> {
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Leon
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- SOFTWARE.
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/react-native-codegen.d.ts"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeModules","Platform","TurboModuleRegistry","LINKING_ERROR","select","ios","default","turboModuleResult","get","turboModule","bridgeModule","SniConnect","nativeModule","Error","NativeSniConnect"],"sourceRoot":"../../src","sources":["NativeSniConnect.ts"],"mappings":";;AAAA,SACEA,aAAa,EACbC,QAAQ,EACRC,mBAAmB,QAEd,cAAc;AAoCrB,MAAMC,aAAa,GACjB,4FAA4F,GAC5FF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,mEAAmE;AASrE,MAAMC,iBAAiB,GAAGL,mBAAmB,CAACM,GAAG,CAAO,YAAY,CAAC;AAErE,MAAMC,WAAwB,GAAGF,iBAAiB,IAAI,IAAI;AAE1D,MAAMG,YAAyB,GAC5BV,aAAa,CAACW,UAAU,IAAyB,IAAI;AAExD,MAAMC,YAAY,GAAIH,WAAW,IAAIC,YAAwC;AAE7E,IAAIE,YAAY,IAAI,IAAI,EAAE;EACxB,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;AAChC;AAEA,MAAMW,gBAAkC,GAAGF,YAAY;AAEvD,eAAeE,gBAAgB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeSniConnect","eventEmitter","subscribeToLogs","callback","subscription","addListener","log","remove","request","config","cancelRequest","requestId","cancelAllRequests","clearDNSCache"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,cAAc;AACjD,OAAOC,gBAAgB,MAGhB,uBAAoB;;AAE3B;;AAOA;AACA,MAAMC,YAAY,GAAG,IAAIF,kBAAkB,CAACC,gBAAuB,CAAC;;AAEpE;AACA,OAAO,SAASE,eAAeA,CAACC,QAAiC,EAAc;EAC7E,MAAMC,YAAY,GAAGH,YAAY,CAACI,WAAW,CAAC,eAAe,EAAGC,GAAQ,IAAK;IAC3E;IACAH,QAAQ,CAACG,GAAe,CAAC;EAC3B,CAAC,CAAC;EACF,OAAO,MAAMF,YAAY,CAACG,MAAM,CAAC,CAAC;AACpC;AAEA,OAAO,SAASC,OAAOA,CACrBC,MAAyB,EACI;EAC7B,OAAOT,gBAAgB,CAACQ,OAAO,CAACC,MAAM,CAAC;AACzC;AAEA,OAAO,SAASC,aAAaA,CAC3BC,SAAiB,EACc;EAC/B,OAAOX,gBAAgB,CAACU,aAAa,CAACC,SAAS,CAAC;AAClD;AAEA,OAAO,SAASC,iBAAiBA,CAAA,EAAkC;EACjE,OAAOZ,gBAAgB,CAACY,iBAAiB,CAA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