@onekeyfe/react-native-webview-cleaner 1.0.0 → 6.7.0-alpha.369

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,9 +1,13 @@
1
1
  # react-native-webview-cleaner
2
2
 
3
- React Native Webview Cache Cleaner for iOS and Android.
3
+ React Native WebView website data cleaner for iOS and Android.
4
4
 
5
- ## Usage
6
- ```js
7
- import WebViewCleaner from "react-native-webview-cleaner"
5
+ See the [behavioral contract](docs/SPEC.md) for platform behavior and completion limits.
8
6
 
9
- WebViewCleaner.clearAll()
7
+ ```ts
8
+ import WebViewCleaner from 'react-native-webview-cleaner';
9
+
10
+ WebViewCleaner.clearAll();
11
+ ```
12
+
13
+ The public API and native module name are retained from the published legacy bridge package.
@@ -2,7 +2,7 @@
2
2
  apply plugin: 'com.android.library'
3
3
 
4
4
  android {
5
- compileSdkVersion 30
5
+ compileSdkVersion(rootProject.ext.has('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30)
6
6
  buildToolsVersion "23.0.1"
7
7
 
8
8
  defaultConfig {
@@ -22,4 +22,3 @@ android {
22
22
  dependencies {
23
23
  implementation 'com.facebook.react:react-native:+'
24
24
  }
25
-
package/docs/SPEC.md ADDED
@@ -0,0 +1,59 @@
1
+ # React Native WebView Cleaner contract
2
+
3
+ Status: Implemented migration of the published `@onekeyfe/react-native-webview-cleaner` legacy bridge. Source and local package checks passed; consumer Release runtime checks are pending.
4
+
5
+ ## Purpose, scope, and non-goals
6
+
7
+ The package exposes the existing `clearAll()` call to React Native on iOS and Android. It requests removal of app-wide WebView website data through the platform APIs described below. It does not clear every on-disk WebView cache, distinguish wallet accounts, or add a completion result to the JavaScript API. Web is unsupported.
8
+
9
+ ## Definitions and ownership boundaries
10
+
11
+ JavaScript owns only a wrapper around `NativeModules.RNWebViewCleaner`. Native code invokes system-owned WebKit or Android WebView stores. The system owns the stored website data and completion timing. On iOS and Android, the app's `main` and `bg` JavaScript heaps are independent, while their native website data stores are app-wide resources; calls from either runtime can affect the same underlying data. No caller-specific partition or cross-runtime queue is provided.
12
+
13
+ ## Public API and defaults
14
+
15
+ The package default export has `clearAll(): void`. The wrapper invokes `NativeModules.RNWebViewCleaner.clearAll()` and does not return its native result. It takes no arguments, applies no filters, and has no caller-visible completion callback. The native module name remains `RNWebViewCleaner`; the package name remains `@onekeyfe/react-native-webview-cleaner`, with the existing React Native consumer alias `react-native-webview-cleaner`.
16
+
17
+ The package retains its CommonJS, ESM, TypeScript declarations, and React Native source entry points. This migration must preserve the old import and autolinking paths. No data is serialized across the bridge by this call.
18
+
19
+ ## Lifecycle and concurrency
20
+
21
+ Each call starts the platform deletion work. The wrapper does not await completion, cancel a call, serialize calls, or guard concurrent calls from separate JavaScript runtimes. Callers must not assume that a later WebView use waits for deletion to finish. Repeated calls may overlap. The package retains no JavaScript cache or request state.
22
+
23
+ ## Data, cache, and identity
24
+
25
+ The operation targets the default platform website data stores, without a wallet, account, tab, URL, or request key. It does not own persistent data formats or perform migrations. Clearing may affect other WebViews in the same app because the native stores are app-wide.
26
+
27
+ ## Platform contract
28
+
29
+ | Platform | Existing native action | Completion visible to JavaScript |
30
+ | --- | --- | --- |
31
+ | iOS | On the main queue, `WKWebsiteDataStore.defaultDataStore` removes all website data types modified since the Unix epoch. The native promise resolves with `nil` in the completion handler. | No. The JavaScript wrapper discards the native promise. |
32
+ | Android | `CookieManager.removeAllCookies(null)`, `CookieManager.flush()`, then `WebStorage.deleteAllData()`. | No. The native method returns `void`; cookie removal may still be pending. |
33
+ | Web | Unsupported. | Not applicable. |
34
+
35
+ The Android operation does not claim to clear every WebView disk cache. Platform APIs and ordering remain as in the published package; the migration must not normalize these differences by changing the public API.
36
+
37
+ ## Failure, fallback, and safety
38
+
39
+ The wrapper has no retry, fallback, or explicit error mapping. An unavailable `NativeModules.RNWebViewCleaner` can cause a synchronous JavaScript failure. Native asynchronous failures are not reported through `clearAll()`. The package does not bypass platform permissions or security checks. The system APIs determine data volume and duration; the package sets no numeric limit.
40
+
41
+ ## Performance and resource budget
42
+
43
+ The wrapper performs one bridge call. Native deletion can involve system I/O; neither latency nor bytes removed are guaranteed. No measured performance claim is made. The iOS native code dispatches its WebKit call to the main queue as in the published implementation.
44
+
45
+ ## Migration exception and conformance
46
+
47
+ Repository policy requires starting new packages with `yarn create:module`; that template generates a Nitro implementation. This package is an explicit legacy-bridge migration exception: the generated Nitro interface, Swift implementation, Kotlin module, C++ adapter, CMake file, `nitro.json`, and Nitro-only peer/configuration must be replaced or removed. A Nitro rewrite would change the native module name, generated ABI, and JavaScript call path without being required to fix the Android compile SDK issue.
48
+
49
+ The template-created `src/index.tsx`, `src/ReactNativeWebviewCleaner.nitro.ts`, `ios/ReactNativeWebviewCleaner.swift`, generated podspec, `android/CMakeLists.txt`, `android/gradle.properties`, C++ adapter, two Kotlin files, and `nitro.json` were removed. The package uses its original `src/index.ts`, Objective-C bridge, Android Java bridge, podspec, Babel/TypeScript build settings, and copyright license. The repository's ESLint, Git hook, and Turbo task conventions remain; the Turbo task has no Nitro output.
50
+
51
+ The migrated `src/index.ts`, `ios/RNWebViewCleaner/*`, Android Java module/package, and podspec must retain the published behavior. The only Android native build change is to use `rootProject.ext.compileSdkVersion` when defined, falling back to the old API 30 value otherwise. The existing minimum SDK, target SDK, ABI filter, and build tools declaration remain unchanged.
52
+
53
+ The standalone package's Yarn 3 `packageManager`, ignored dependency resolution, and nonexistent `example` workspace/script are omitted so this workspace uses the repository's Yarn 4 installation. Its release script follows the repository's package workflow. The newer Bob version emits the same CommonJS implementation and TypeScript declarations, adds `"use strict"` to an already strict ESM module, and updates JavaScript source maps; these changes do not add an API or native behavior. The legacy podspec still contains its historical `s.source` repository placeholder. The current consumer uses CocoaPods `:path` autolinking from the installed npm package and does not fetch that source; standalone CocoaPods source-based installation is outside this migration's verified scope.
54
+
55
+ The generated template `.gitignore`, migrated Android Gradle file, and migrated podspec had trailing blank whitespace removed to satisfy repository diff checks. Those edits do not change native code, dependency coordinates, or build settings.
56
+
57
+ The standalone Xcode project contained ignored `project.xcworkspace/contents.xcworkspacedata`, `project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist`, and `xcuserdata/cancue.xcuserdatad/xcschemes/xcschememanagement.plist` files. They are omitted from this workspace and its published tarball because none is tracked by the template policy or used by the podspec's Objective-C source selection. The original standalone repository retains them; this omission has no runtime effect.
58
+
59
+ Source and package comparison with published 1.0.0 must show the native implementation and JavaScript source byte-identical; the Android Gradle file differs by the compile SDK line and terminal whitespace, and the podspec differs only by terminal whitespace. Generated entry points and declarations must preserve `clearAll(): void`; the shipped package must include this spec linked from its README. The candidate Android AAR metadata task must pass with the consumer's compile SDK and React Native version. Full consumer Release APK/R8 and iOS archive/runtime tests are separate evidence and remain pending until the published version is installed and locked.
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","clearAll","NativeModules","RNWebViewCleaner"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAA6C,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE9B;EACbC,QAAQ,EAAEA,CAAA,KAAM;IACdC,0BAAa,CAACC,gBAAgB,CAACF,QAAQ,CAAC,CAAC;EAC3C;AACF,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","clearAll","NativeModules","RNWebViewCleaner"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAA6C,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE9B;EACbC,QAAQ,EAAEA,CAAA,KAAM;IACdC,0BAAa,CAACC,gBAAgB,CAACF,QAAQ,CAAC,CAAC;EAC3C;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,3 +1,5 @@
1
+ "use strict";
2
+
1
3
  import { NativeModules } from 'react-native';
2
4
  export default {
3
5
  clearAll: () => {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","clearAll","RNWebViewCleaner"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,eAAe;EACbC,QAAQ,EAAEA,CAAA,KAAM;IACdD,aAAa,CAACE,gBAAgB,CAACD,QAAQ,CAAC,CAAC;EAC3C;AACF,CAAC"}
1
+ {"version":3,"names":["NativeModules","clearAll","RNWebViewCleaner"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,eAAe;EACbC,QAAQ,EAAEA,CAAA,KAAM;IACdD,aAAa,CAACE,gBAAgB,CAACD,QAAQ,CAAC,CAAC;EAC3C;AACF,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-webview-cleaner",
3
- "version": "1.0.0",
3
+ "version": "6.7.0-alpha.369",
4
4
  "description": "webview cleaner",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -10,6 +10,7 @@
10
10
  "files": [
11
11
  "src",
12
12
  "lib",
13
+ "docs",
13
14
  "keys",
14
15
  "android",
15
16
  "ios",
@@ -27,13 +28,12 @@
27
28
  "!**/.*"
28
29
  ],
29
30
  "scripts": {
30
- "example": "yarn workspace react-native-webview-cleaner-example",
31
31
  "test": "jest",
32
32
  "typecheck": "tsc --noEmit",
33
33
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
34
34
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
35
35
  "prepare": "bob build",
36
- "release": "release-it"
36
+ "release": "yarn prepare && npm whoami && npm publish --access public"
37
37
  },
38
38
  "keywords": [
39
39
  "react-native",
@@ -42,51 +42,47 @@
42
42
  ],
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "git+https://github.com/OneKeyHQ/react-native-webview-cleaner.git"
45
+ "url": "git+https://github.com/OneKeyHQ/app-modules.git",
46
+ "directory": "native-modules/react-native-webview-cleaner"
46
47
  },
47
48
  "author": "OneKeyHQ <hi@onekey.so> (https://github.com/OneKeyHQ)",
48
49
  "license": "MIT",
49
50
  "bugs": {
50
- "url": "https://github.com/OneKeyHQ/react-native-webview-cleaner/issues"
51
+ "url": "https://github.com/OneKeyHQ/app-modules/issues"
51
52
  },
52
- "homepage": "https://github.com/OneKeyHQ/react-native-webview-cleaner#readme",
53
+ "homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-webview-cleaner#readme",
53
54
  "publishConfig": {
54
55
  "registry": "https://registry.npmjs.org/"
55
56
  },
56
57
  "devDependencies": {
57
- "@commitlint/config-conventional": "^17.0.2",
58
- "@evilmartians/lefthook": "^1.5.0",
59
- "@react-native/eslint-config": "^0.72.2",
60
- "@release-it/conventional-changelog": "^5.0.0",
61
- "@types/jest": "^28.1.2",
62
- "@types/react": "~17.0.21",
63
- "@types/react-native": "0.70.0",
64
- "commitlint": "^17.0.2",
65
- "del-cli": "^5.0.0",
66
- "eslint": "^8.4.1",
67
- "eslint-config-prettier": "^8.5.0",
68
- "eslint-plugin-prettier": "^4.0.0",
69
- "jest": "^28.1.1",
70
- "pod-install": "^0.1.0",
71
- "prettier": "^2.0.5",
72
- "react": "18.2.0",
73
- "react-native": "0.73.1",
74
- "react-native-builder-bob": "^0.23.2",
75
- "release-it": "^15.0.0",
76
- "turbo": "^1.10.7",
77
- "typescript": "^5.0.2"
78
- },
79
- "resolutions": {
80
- "@types/react": "17.0.21"
58
+ "@commitlint/config-conventional": "^19.8.1",
59
+ "@eslint/compat": "^1.3.2",
60
+ "@eslint/eslintrc": "^3.3.1",
61
+ "@eslint/js": "^9.35.0",
62
+ "@react-native/babel-preset": "0.86.2",
63
+ "@react-native/eslint-config": "0.86.2",
64
+ "@release-it/conventional-changelog": "^10.0.1",
65
+ "@types/jest": "^29.5.14",
66
+ "@types/react": "^19.2.0",
67
+ "commitlint": "^19.8.1",
68
+ "del-cli": "^6.0.0",
69
+ "eslint": "^9.35.0",
70
+ "eslint-config-prettier": "^10.1.8",
71
+ "eslint-plugin-prettier": "^5.5.4",
72
+ "jest": "^29.7.0",
73
+ "lefthook": "^2.0.3",
74
+ "prettier": "^2.8.8",
75
+ "react": "19.2.3",
76
+ "react-native": "0.86.2",
77
+ "react-native-builder-bob": "^0.40.13",
78
+ "release-it": "^19.0.4",
79
+ "turbo": "^2.5.6",
80
+ "typescript": "^5.9.2"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": "*",
84
84
  "react-native": "*"
85
85
  },
86
- "workspaces": [
87
- "example"
88
- ],
89
- "packageManager": "yarn@3.6.1",
90
86
  "engines": {
91
87
  "node": ">= 18.0.0"
92
88
  },
@@ -25,4 +25,3 @@ Pod::Spec.new do |s|
25
25
  # ...
26
26
  # s.dependency "..."
27
27
  end
28
-
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:RNWebViewCleaner.xcodeproj">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>RNWebViewCleaner.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>