@secondts/bark-react-native 0.26.0 → 0.26.1
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 +4 -12
- package/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -1
- package/android/proguard-rules.pro +16 -0
- package/app.plugin.js +5 -1
- package/lib/commonjs/WalletNotifications.js +7 -2
- package/lib/commonjs/WalletNotifications.js.map +1 -1
- package/lib/commonjs/generated/bark-ffi.js.map +1 -1
- package/lib/commonjs/generated/bark.js +702 -702
- package/lib/commonjs/generated/bark.js.map +1 -1
- package/lib/module/WalletNotifications.js +7 -2
- package/lib/module/WalletNotifications.js.map +1 -1
- package/lib/module/generated/bark-ffi.js.map +1 -1
- package/lib/module/generated/bark.js +702 -702
- package/lib/module/generated/bark.js.map +1 -1
- package/lib/typescript/commonjs/src/WalletNotifications.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts +1 -1
- package/lib/typescript/commonjs/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/generated/bark.d.ts +20 -14
- package/lib/typescript/commonjs/src/generated/bark.d.ts.map +1 -1
- package/lib/typescript/module/src/WalletNotifications.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark-ffi.d.ts +1 -1
- package/lib/typescript/module/src/generated/bark-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/bark.d.ts +20 -14
- package/lib/typescript/module/src/generated/bark.d.ts.map +1 -1
- package/package.json +5 -10
- package/scripts/postinstall.js +92 -31
- package/src/WalletNotifications.ts +7 -2
- package/src/generated/bark-ffi.ts +396 -1022
- package/src/generated/bark.ts +11978 -14893
- package/lib/typescript/commonjs/plugin/src/index.d.ts +0 -11
- package/lib/typescript/commonjs/plugin/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +0 -6
- package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +0 -1
- package/lib/typescript/commonjs/plugin/src/withIOS.d.ts +0 -7
- package/lib/typescript/commonjs/plugin/src/withIOS.d.ts.map +0 -1
- package/lib/typescript/module/plugin/src/index.d.ts +0 -11
- package/lib/typescript/module/plugin/src/index.d.ts.map +0 -1
- package/lib/typescript/module/plugin/src/withAndroid.d.ts +0 -6
- package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +0 -1
- package/lib/typescript/module/plugin/src/withIOS.d.ts +0 -7
- package/lib/typescript/module/plugin/src/withIOS.d.ts.map +0 -1
- package/plugin/build/index.d.ts +0 -10
- package/plugin/build/index.js +0 -16
- package/plugin/build/withAndroid.d.ts +0 -5
- package/plugin/build/withAndroid.js +0 -26
- package/plugin/build/withIOS.d.ts +0 -6
- package/plugin/build/withIOS.js +0 -13
- package/plugin/tsconfig.json +0 -9
- package/plugin/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondts/bark-react-native",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"description": "Bark FFI bindings for React Native",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -30,8 +30,6 @@
|
|
|
30
30
|
"react-native.config.js",
|
|
31
31
|
"scripts",
|
|
32
32
|
"!scripts/patch-bindings.sh",
|
|
33
|
-
"plugin",
|
|
34
|
-
"!plugin/src",
|
|
35
33
|
"!ios/build",
|
|
36
34
|
"!ios/generated/build/generated/ios/FBReactNativeSpec",
|
|
37
35
|
"!ios/generated/build/generated/ios/FBReactNativeSpec/**",
|
|
@@ -40,6 +38,7 @@
|
|
|
40
38
|
"!ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.h",
|
|
41
39
|
"!ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.mm",
|
|
42
40
|
"!android/build",
|
|
41
|
+
"!android/src/main/jniLibs",
|
|
43
42
|
"!android/gradle",
|
|
44
43
|
"!android/gradlew",
|
|
45
44
|
"!android/gradlew.bat",
|
|
@@ -57,8 +56,6 @@
|
|
|
57
56
|
"ubrn:checkout": "ubrn checkout",
|
|
58
57
|
"ubrn:clean": "rm -rfv cpp/ android/CMakeLists.txt android/src/main/java 'android/*.cpp' ios/ 'src/Native*' 'src/index.*ts*' src/generated/",
|
|
59
58
|
"postinstall": "node scripts/postinstall.js",
|
|
60
|
-
"plugin:build": "EXPO_NONINTERACTIVE=true expo-module build plugin",
|
|
61
|
-
"plugin:build:win": "tsc --project plugin/tsconfig.json",
|
|
62
59
|
"example": "yarn workspace bark-react-native-example",
|
|
63
60
|
"typecheck": "tsc"
|
|
64
61
|
},
|
|
@@ -86,20 +83,18 @@
|
|
|
86
83
|
"registry": "https://registry.npmjs.org/",
|
|
87
84
|
"access": "public"
|
|
88
85
|
},
|
|
89
|
-
"releaseTag": "v0.26.
|
|
86
|
+
"releaseTag": "v0.26.1+bark-0.8.0",
|
|
90
87
|
"checksums": {
|
|
91
|
-
"android": "
|
|
92
|
-
"ios": "
|
|
88
|
+
"android": "b93b6f872f8b66edff349be336bb5ebb06d3615f15eb1d2f9915758d147e7067",
|
|
89
|
+
"ios": "9e5d29cc0a0f775d09d58a1e02a470560667869f4c28f37f50e7ef986a9d82a3"
|
|
93
90
|
},
|
|
94
91
|
"dependencies": {
|
|
95
92
|
"@ubjs/core": "0.31.0-5",
|
|
96
93
|
"uniffi-bindgen-react-native": "0.31.0-5"
|
|
97
94
|
},
|
|
98
95
|
"devDependencies": {
|
|
99
|
-
"@expo/config-plugins": "^9.0.0",
|
|
100
96
|
"@react-native-community/cli": "15.0.1",
|
|
101
97
|
"@types/react": "^18.2.44",
|
|
102
|
-
"expo-module-scripts": "^4.0.0",
|
|
103
98
|
"react": "19.0.0",
|
|
104
99
|
"react-native": "0.76.9",
|
|
105
100
|
"react-native-builder-bob": "^0.40.17",
|
package/scripts/postinstall.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Postinstall script for @secondts/bark-react-native
|
|
4
4
|
*
|
|
5
5
|
* Downloads prebuilt native binaries from GitLab Package Registry.
|
|
6
|
-
* Verifies SHA-256 checksums before extracting
|
|
6
|
+
* Verifies SHA-256 checksums before extracting, then records the verified
|
|
7
|
+
* checksum in a marker file so later installs can tell verified artifacts
|
|
8
|
+
* apart from partial extractions or binaries from another version.
|
|
7
9
|
*
|
|
8
10
|
* Environment variables:
|
|
9
11
|
* SKIP_BARK_POSTINSTALL - Set to skip downloading artifacts
|
|
@@ -155,22 +157,64 @@ function cleanup(filePath) {
|
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
|
|
160
|
+
// Dotfiles are excluded from the npm tarball (`!**/.*` in package.json), so the
|
|
161
|
+
// marker is only ever written by this script.
|
|
162
|
+
function markerPath(artifact) {
|
|
163
|
+
return path.join(
|
|
164
|
+
PACKAGE_ROOT,
|
|
165
|
+
`.native-artifacts-${artifact.checksumKey}.sha256`,
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function isVerifiedInstall(artifact, checksum) {
|
|
170
|
+
if (!fs.existsSync(artifact.existsPath)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
return fs.readFileSync(markerPath(artifact), "utf8").trim() === checksum;
|
|
175
|
+
} catch (_) {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Each archive holds exactly one artifact path relative to the package root
|
|
181
|
+
// (`android/src/main/jniLibs`, `build/RnBark.xcframework`). It is extracted into
|
|
182
|
+
// a staging directory first and only swapped in once complete, so a failed
|
|
183
|
+
// download, checksum or extraction leaves the existing artifacts untouched.
|
|
184
|
+
// Kept short: these paths sit deep inside node_modules on Windows.
|
|
185
|
+
function stagingDir(artifact) {
|
|
186
|
+
return path.join(PACKAGE_ROOT, `.stage-${artifact.checksumKey}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function downloadAndExtract(artifact, url, zipPath, checksum) {
|
|
190
|
+
const staging = stagingDir(artifact);
|
|
191
|
+
const artifactPath = path.relative(PACKAGE_ROOT, artifact.existsPath);
|
|
192
|
+
const stagedPath = path.join(staging, artifactPath);
|
|
193
|
+
|
|
159
194
|
try {
|
|
160
|
-
|
|
195
|
+
fs.rmSync(staging, { recursive: true, force: true });
|
|
196
|
+
|
|
197
|
+
console.log(`[bark-react-native] Downloading ${artifact.name} artifacts...`);
|
|
161
198
|
await download(url, zipPath);
|
|
162
199
|
|
|
163
|
-
console.log(`[bark-react-native] Verifying ${name} checksum...`);
|
|
200
|
+
console.log(`[bark-react-native] Verifying ${artifact.name} checksum...`);
|
|
164
201
|
await verifyChecksum(zipPath, checksum);
|
|
165
202
|
|
|
166
|
-
console.log(`[bark-react-native] Extracting ${name} artifacts...`);
|
|
167
|
-
extractZip(zipPath,
|
|
168
|
-
|
|
203
|
+
console.log(`[bark-react-native] Extracting ${artifact.name} artifacts...`);
|
|
204
|
+
extractZip(zipPath, staging);
|
|
205
|
+
if (!fs.existsSync(stagedPath)) {
|
|
206
|
+
throw new Error(`${artifact.zipName} does not contain ${artifactPath}`);
|
|
207
|
+
}
|
|
169
208
|
|
|
170
|
-
|
|
171
|
-
|
|
209
|
+
fs.rmSync(artifact.existsPath, { recursive: true, force: true });
|
|
210
|
+
fs.mkdirSync(path.dirname(artifact.existsPath), { recursive: true });
|
|
211
|
+
fs.renameSync(stagedPath, artifact.existsPath);
|
|
212
|
+
fs.writeFileSync(markerPath(artifact), `${checksum}\n`);
|
|
213
|
+
|
|
214
|
+
console.log(`[bark-react-native] ${artifact.name} artifacts: OK`);
|
|
215
|
+
} finally {
|
|
172
216
|
cleanup(zipPath);
|
|
173
|
-
|
|
217
|
+
fs.rmSync(staging, { recursive: true, force: true });
|
|
174
218
|
}
|
|
175
219
|
}
|
|
176
220
|
|
|
@@ -182,24 +226,25 @@ async function main() {
|
|
|
182
226
|
return;
|
|
183
227
|
}
|
|
184
228
|
|
|
185
|
-
const allExist = ARTIFACTS.every(
|
|
186
|
-
(a) =>
|
|
187
|
-
fs.existsSync(a.existsPath) ||
|
|
188
|
-
(a.platformGuard && process.platform !== a.platformGuard),
|
|
189
|
-
);
|
|
190
|
-
if (allExist) {
|
|
191
|
-
console.log(
|
|
192
|
-
"[bark-react-native] Native artifacts already present, skipping download",
|
|
193
|
-
);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
229
|
const packageJson = JSON.parse(
|
|
198
230
|
fs.readFileSync(path.join(PACKAGE_ROOT, "package.json"), "utf8"),
|
|
199
231
|
);
|
|
200
232
|
const { checksums } = packageJson;
|
|
201
233
|
|
|
234
|
+
// A repository checkout has empty checksums (CI fills them at publish time).
|
|
235
|
+
// Artifacts there come from a local `ubrn` build, so leave them untouched.
|
|
202
236
|
if (!checksums || !checksums.android) {
|
|
237
|
+
const allExist = ARTIFACTS.every(
|
|
238
|
+
(a) =>
|
|
239
|
+
fs.existsSync(a.existsPath) ||
|
|
240
|
+
(a.platformGuard && process.platform !== a.platformGuard),
|
|
241
|
+
);
|
|
242
|
+
if (allExist) {
|
|
243
|
+
console.log(
|
|
244
|
+
"[bark-react-native] Native artifacts already present, skipping download",
|
|
245
|
+
);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
203
248
|
console.log(
|
|
204
249
|
"[bark-react-native] No checksums found in package.json, skipping download",
|
|
205
250
|
);
|
|
@@ -220,17 +265,10 @@ async function main() {
|
|
|
220
265
|
process.exit(1);
|
|
221
266
|
}
|
|
222
267
|
|
|
223
|
-
console.log(
|
|
224
|
-
`[bark-react-native] Downloading prebuilt binaries for ${releaseTag}...`,
|
|
225
|
-
);
|
|
226
|
-
|
|
227
268
|
for (const artifact of ARTIFACTS) {
|
|
228
269
|
if (artifact.platformGuard && process.platform !== artifact.platformGuard) {
|
|
229
270
|
continue;
|
|
230
271
|
}
|
|
231
|
-
if (fs.existsSync(artifact.existsPath)) {
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
234
272
|
|
|
235
273
|
const checksum = checksums[artifact.checksumKey];
|
|
236
274
|
if (!checksum) {
|
|
@@ -241,12 +279,35 @@ async function main() {
|
|
|
241
279
|
continue;
|
|
242
280
|
}
|
|
243
281
|
|
|
282
|
+
if (isVerifiedInstall(artifact, checksum)) {
|
|
283
|
+
console.log(
|
|
284
|
+
`[bark-react-native] ${artifact.name} artifacts already verified for ${releaseTag}`,
|
|
285
|
+
);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Drop the marker first so artifacts that fail to be replaced can never be
|
|
290
|
+
// vouched for by a marker left over from an earlier install.
|
|
291
|
+
cleanup(markerPath(artifact));
|
|
292
|
+
|
|
293
|
+
// Present without a matching marker: binaries from another version or of
|
|
294
|
+
// unknown origin. They stay in place until a verified copy replaces them.
|
|
295
|
+
if (fs.existsSync(artifact.existsPath)) {
|
|
296
|
+
console.log(
|
|
297
|
+
`[bark-react-native] Found unverified ${artifact.name} artifacts, fetching a verified copy`,
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
console.log(
|
|
302
|
+
`[bark-react-native] Downloading prebuilt binaries for ${releaseTag}...`,
|
|
303
|
+
);
|
|
304
|
+
|
|
244
305
|
const zipPath = path.join(PACKAGE_ROOT, artifact.zipName);
|
|
245
306
|
const encodedTag = releaseTag.replace(/\+/g, "%2B");
|
|
246
307
|
const url = `${BASE_URL}/${encodedTag}/downloads/${artifact.zipName}`;
|
|
247
308
|
|
|
248
309
|
try {
|
|
249
|
-
await downloadAndExtract(artifact
|
|
310
|
+
await downloadAndExtract(artifact, url, zipPath, checksum);
|
|
250
311
|
} catch (err) {
|
|
251
312
|
console.error(
|
|
252
313
|
`[bark-react-native] Failed to download ${artifact.name} artifacts: ${err.message}`,
|
|
@@ -258,7 +319,7 @@ async function main() {
|
|
|
258
319
|
}
|
|
259
320
|
}
|
|
260
321
|
|
|
261
|
-
console.log("[bark-react-native] Native artifacts
|
|
322
|
+
console.log("[bark-react-native] Native artifacts ready");
|
|
262
323
|
}
|
|
263
324
|
|
|
264
325
|
main().catch((err) => {
|
|
@@ -62,10 +62,15 @@ export class WalletNotifications {
|
|
|
62
62
|
this.holder = localHolder;
|
|
63
63
|
|
|
64
64
|
(async () => {
|
|
65
|
+
// The loop stays live only while `holder` is still `localHolder`. An
|
|
66
|
+
// unsubscribe that lands while no native wait is pending (from inside a
|
|
67
|
+
// listener, or while an event is in flight) makes the cancel a no-op,
|
|
68
|
+
// so without this check the loop would keep running next to the loop of
|
|
69
|
+
// the next subscription and every event would be delivered twice.
|
|
65
70
|
try {
|
|
66
|
-
while (
|
|
71
|
+
while (this.holder === localHolder) {
|
|
67
72
|
const event = await localHolder.nextNotification();
|
|
68
|
-
if (event == null) break;
|
|
73
|
+
if (event == null || this.holder !== localHolder) break;
|
|
69
74
|
for (const listener of this.listeners) {
|
|
70
75
|
try {
|
|
71
76
|
listener(event);
|