Skip to content

Commit 0199e18

Browse files
committed
fix: workaround for race condition with turbomodule in android.
fix(cpp.js): include prebuilt/_/{config.general.name}/_.h in dependency header search paths
1 parent 1c2e707 commit 0199e18

File tree

45 files changed

+310
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+310
-294
lines changed

packages/cpp.js/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# cpp.js
22

3+
## 1.0.4
4+
5+
### Patch Changes
6+
7+
- fix: workaround for race condition with turbomodule in android.
8+
9+
## 1.0.1
10+
11+
### Patch Changes
12+
13+
- fix: include prebuilt/_/{config.general.name}/_.h in dependency header search paths
14+
315
## 1.0.0
416

517
### Major Changes

packages/cpp.js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cpp.js",
3-
"version": "1.0.0",
3+
"version": "1.0.4",
44
"license": "MIT",
55
"homepage": "https://cpp.js.org",
66
"repository": "https://github.com/bugra9/cpp.js.git",

packages/cpp.js/src/integration/getCppJsScript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ function getReactNativeScript(env, modulePrefix) {
5151
}
5252
5353
export function initCppJs(config = {}) {
54-
return new Promise((resolve, reject) => {
54+
return new Promise(async (resolve, reject) => {
5555
if (RNJsiLib && RNJsiLib.start) {
56-
RNJsiLib.start();
56+
await RNJsiLib.start();
5757
setEnv();
5858
const m = Module;
5959
${modulePrefix}

packages/cpp.js/src/integration/getDependFilePath.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default function getDependFilePath(source, platform) {
88
const dependPackage = state.config.allDependencies.find((d) => source.startsWith(d.package.name));
99
if (dependPackage) {
1010
const depName = dependPackage.package.name;
11+
const configName = dependPackage.general.name;
1112
const filePath = source.substring(depName.length + 1);
1213

1314
let path;
@@ -19,7 +20,9 @@ export default function getDependFilePath(source, platform) {
1920
path = `${dependPackage.paths.output}/prebuilt/${platform}`;
2021
}
2122

22-
if (fs.existsSync(`${path}/${depName}/${filePath}`)) {
23+
if (fs.existsSync(`${path}/${configName}/${filePath}`)) {
24+
path = `${path}/${configName}/${filePath}`;
25+
} else if (fs.existsSync(`${path}/${depName}/${filePath}`)) {
2326
path = `${path}/${depName}/${filePath}`;
2427
} else if (fs.existsSync(`${path}/${filePath}`)) {
2528
path = `${path}/${filePath}`;

packages/cppjs-core-create-app/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# create-cpp.js
22

3+
## 1.0.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- cpp.js@1.0.4
9+
- @cpp.js/sample-backend-nodejs-wasm@1.0.1
10+
- @cpp.js/sample-cloud-cloudflare-worker@1.0.1
11+
- @cpp.js/sample-mobile-reactnative-cli@1.0.1
12+
- @cpp.js/sample-mobile-reactnative-expo@1.0.1
13+
- @cpp.js/sample-web-react-rspack@1.0.1
14+
- @cpp.js/sample-web-react-vite@1.0.1
15+
- @cpp.js/sample-web-svelte-vite@1.0.1
16+
- @cpp.js/sample-web-vanilla@1.0.1
17+
- @cpp.js/sample-web-vue-vite@1.0.1
18+
319
## 1.0.1
420

521
### Major Changes

packages/cppjs-core-create-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-cpp.js",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Create Cpp.js Applications",
55
"homepage": "https://github.com/bugra9/cpp.js/tree/main/packages/cppjs-core-create-app#readme",
66
"repository": "https://github.com/bugra9/cpp.js.git",
@@ -21,7 +21,7 @@
2121
"@cpp.js/sample-backend-nodejs-wasm": "workspace:^",
2222
"@cpp.js/sample-cloud-cloudflare-worker": "workspace:^",
2323
"@cpp.js/sample-mobile-reactnative-cli": "workspace:^",
24-
"@cpp.js/sample-mobile-reactnative-expo": "1.0.0",
24+
"@cpp.js/sample-mobile-reactnative-expo": "1.0.1",
2525
"fs-extra": "^11.2.0",
2626
"kleur": "^4.1.5",
2727
"prompts": "^2.4.2",

packages/cppjs-core-embind-jsi/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @cpp.js/core-embind-jsi
22

3+
## 1.0.3
4+
5+
### Patch Changes
6+
7+
- fix: workaround for race condition with turbomodule in android.
8+
39
## 1.0.0
410

511
### Major Changes

packages/cppjs-core-embind-jsi/cpp/src/emscripten/bind.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include <unordered_map>
2222
#include <stdlib.h>
2323

24+
#ifdef __ANDROID__
25+
#include <unistd.h>
26+
#endif
2427

2528
using namespace emscripten;
2629
using namespace internal;
@@ -915,6 +918,10 @@ namespace emscripten {
915918
CppJS::setEnv("CPPJS_DATA_PATH", path, false);
916919
jsRuntime = &rt;
917920

921+
#ifdef __ANDROID__
922+
sleep(2);
923+
#endif
924+
918925
char* name = "M";
919926
uint64_t namePtrNumber = reinterpret_cast<uint64_t>(name);
920927
// uint64_t offset = (namePtrNumber >> 32) << 32;

packages/cppjs-core-embind-jsi/js/embind.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4748,7 +4748,6 @@ globalThis.Module['ASSERTIONS'] = true;
47484748
export default globalThis.Module;
47494749

47504750
function toArray(vector) {
4751-
console.log('aaaaa', vector);
47524751
const output = [];
47534752
for (let i = 0; i < vector.size(); i += 1) {
47544753
output.push(vector.get(i));

packages/cppjs-core-embind-jsi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cpp.js/core-embind-jsi",
3-
"version": "1.0.0",
3+
"version": "1.0.3",
44
"description": "The Embind JSI integration tool enables seamless C++ integration with React Native and Expo.",
55
"homepage": "https://github.com/bugra9/cpp.js/tree/main/packages/cppjs-core-embind-jsi#readme",
66
"repository": "https://github.com/bugra9/cpp.js.git",

0 commit comments

Comments
 (0)