@@ -2,7 +2,6 @@ import assert from "node:assert/strict";
2
2
import cp from "node:child_process" ;
3
3
import fs from "node:fs" ;
4
4
import path from "node:path" ;
5
- import { fileURLToPath } from "node:url" ;
6
5
7
6
import { spawn } from "bufout" ;
8
7
import chalk from "chalk" ;
@@ -15,9 +14,7 @@ import {
15
14
isAppleTarget ,
16
15
} from "./targets.js" ;
17
16
18
- const WEAK_NODE_API_PATH = fileURLToPath (
19
- import . meta. resolve ( "react-native-node-api/weak-node-api" )
20
- ) ;
17
+ import { weakNodeApiPath } from "react-native-node-api" ;
21
18
22
19
const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET : Record < AppleTargetName , string > = {
23
20
"aarch64-apple-darwin" : "macos-arm64_x86_64" , // Universal
@@ -126,18 +123,16 @@ export function getTargetAndroidPlatform(target: AndroidTargetName) {
126
123
}
127
124
128
125
export function getWeakNodeApiFrameworkPath ( target : AppleTargetName ) {
129
- assert ( fs . existsSync ( WEAK_NODE_API_PATH ) , "Expected weak-node-api to exist" ) ;
130
126
return joinPathAndAssertExistence (
131
- WEAK_NODE_API_PATH ,
127
+ weakNodeApiPath ,
132
128
"weak-node-api.xcframework" ,
133
129
APPLE_XCFRAMEWORK_CHILDS_PER_TARGET [ target ]
134
130
) ;
135
131
}
136
132
137
133
export function getWeakNodeApiAndroidLibraryPath ( target : AndroidTargetName ) {
138
- assert ( fs . existsSync ( WEAK_NODE_API_PATH ) , "Expected weak-node-api to exist" ) ;
139
134
return joinPathAndAssertExistence (
140
- WEAK_NODE_API_PATH ,
135
+ weakNodeApiPath ,
141
136
"weak-node-api.android.node" ,
142
137
ANDROID_ARCH_PR_TARGET [ target ]
143
138
) ;
@@ -202,7 +197,10 @@ export function getTargetEnvironmentVariables({
202
197
toolchainBinPath ,
203
198
`${ targetArch } -linux-${ targetPlatform } -clang++${ cmdMaybe } `
204
199
) ,
205
- TARGET_AR : joinPathAndAssertExistence ( toolchainBinPath , `llvm-ar${ exeMaybe } ` ) ,
200
+ TARGET_AR : joinPathAndAssertExistence (
201
+ toolchainBinPath ,
202
+ `llvm-ar${ exeMaybe } `
203
+ ) ,
206
204
TARGET_RANLIB : joinPathAndAssertExistence (
207
205
toolchainBinPath ,
208
206
`llvm-ranlib${ exeMaybe } `
0 commit comments