react-native-executorch 0.10.4 → 0.10.5
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/lib/module/extensions/speech/utils/textPartitioner.js +18 -6
- package/lib/module/extensions/speech/utils/textPartitioner.js.map +1 -1
- package/lib/module/fetcher/telemetry.js +1 -1
- package/lib/typescript/src/extensions/speech/utils/textPartitioner.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-executorch.podspec +4 -5
- package/scripts/download-libs.js +65 -24
- package/src/extensions/speech/utils/textPartitioner.ts +12 -3
- package/src/fetcher/telemetry.ts +1 -1
- package/third-party/README.md +2 -1
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import { RnExecuTorchError } from "../../../core/error.js";
|
|
9
9
|
// Punctuation Regex Patterns
|
|
10
|
-
const EOS_PATTERN = /[
|
|
11
|
-
const PAUSE_PATTERN = /[,:\u2014\u00AB\u00BB]/;
|
|
10
|
+
const EOS_PATTERN = /[.?!;…|।॥¿¡。.!?;]/;
|
|
11
|
+
const PAUSE_PATTERN = /[,:\u2014\u00AB\u00BB、,:〜~]/;
|
|
12
12
|
const WHITESPACE_PATTERN = /\s/;
|
|
13
13
|
|
|
14
14
|
// Standard Partitioning Constants
|
|
@@ -88,12 +88,24 @@ export function partition(text, limit, options) {
|
|
|
88
88
|
};
|
|
89
89
|
const breakpoints = [];
|
|
90
90
|
let charIdx = 0;
|
|
91
|
+
let lastBpIdx = -1;
|
|
91
92
|
for (const char of text) {
|
|
93
|
+
const endIdx = charIdx + char.length - 1;
|
|
92
94
|
const t = tagFromChar(char);
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
if (endIdx - lastBpIdx > limit) {
|
|
96
|
+
breakpoints.push({
|
|
97
|
+
idx: charIdx - 1,
|
|
98
|
+
tag: 'whitespace'
|
|
99
|
+
});
|
|
100
|
+
lastBpIdx = charIdx - 1;
|
|
101
|
+
}
|
|
102
|
+
if (t) {
|
|
103
|
+
breakpoints.push({
|
|
104
|
+
idx: endIdx,
|
|
105
|
+
tag: t
|
|
106
|
+
});
|
|
107
|
+
lastBpIdx = endIdx;
|
|
108
|
+
}
|
|
97
109
|
charIdx += char.length;
|
|
98
110
|
}
|
|
99
111
|
if (breakpoints.length === 0 || breakpoints[breakpoints.length - 1].idx < text.length - 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RnExecuTorchError","EOS_PATTERN","PAUSE_PATTERN","WHITESPACE_PATTERN","MAX_TARGET_PHRASE_LENGTH","MIN_PARTITION_LIMIT","DEVIATION_SCALING","TARGET_LENGTH_RATIO","INITIAL_TARGET_LENGTH_RATIO","RAMP_CHARACTER_COUNT","INITIAL_SHORT_DEVIATION_SCALE","DEFAULT_SEPARATOR_PENALTY","eos","pause","whitespace","tagFromChar","char","test","getTargetLength","startCharIdx","limit","prioritizeInitialTtfa","maxTarget","Math","min","minTarget","max","progress","sliceAtCuts","text","cutIndices","chunks","startIdx","cutIdx","push","slice","map","c","trim","filter","length","partition","options","initialShortDeviationScale","separatorPenalty","separatorPenalties","breakpoints","charIdx","t","idx","tag","currBreakIdx","prevBreakIdx","cost","len","Infinity","targetLength","isFirstChunk","diff","devScale","minCost","Float32Array","predecessor","Int32Array","jMin","fill","i","j","total","cuts","reverse"],"sourceRoot":"../../../../../src","sources":["extensions/speech/utils/textPartitioner.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,wBAAqB;AAGvD;AACA,MAAMC,WAAW,GAAG,
|
|
1
|
+
{"version":3,"names":["RnExecuTorchError","EOS_PATTERN","PAUSE_PATTERN","WHITESPACE_PATTERN","MAX_TARGET_PHRASE_LENGTH","MIN_PARTITION_LIMIT","DEVIATION_SCALING","TARGET_LENGTH_RATIO","INITIAL_TARGET_LENGTH_RATIO","RAMP_CHARACTER_COUNT","INITIAL_SHORT_DEVIATION_SCALE","DEFAULT_SEPARATOR_PENALTY","eos","pause","whitespace","tagFromChar","char","test","getTargetLength","startCharIdx","limit","prioritizeInitialTtfa","maxTarget","Math","min","minTarget","max","progress","sliceAtCuts","text","cutIndices","chunks","startIdx","cutIdx","push","slice","map","c","trim","filter","length","partition","options","initialShortDeviationScale","separatorPenalty","separatorPenalties","breakpoints","charIdx","lastBpIdx","endIdx","t","idx","tag","currBreakIdx","prevBreakIdx","cost","len","Infinity","targetLength","isFirstChunk","diff","devScale","minCost","Float32Array","predecessor","Int32Array","jMin","fill","i","j","total","cuts","reverse"],"sourceRoot":"../../../../../src","sources":["extensions/speech/utils/textPartitioner.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,wBAAqB;AAGvD;AACA,MAAMC,WAAW,GAAG,mBAAmB;AACvC,MAAMC,aAAa,GAAG,6BAA6B;AACnD,MAAMC,kBAAkB,GAAG,IAAI;;AAE/B;AACA,MAAMC,wBAAwB,GAAG,GAAG;AACpC,MAAMC,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,mBAAmB,GAAG,GAAG;;AAE/B;AACA,MAAMC,2BAA2B,GAAG,IAAI;AACxC,MAAMC,oBAAoB,GAAG,GAAG;AAChC,MAAMC,6BAA6B,GAAG,GAAG;;AAEzC;AACA,MAAMC,yBAA8C,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,KAAK,EAAE,EAAE;EAAEC,UAAU,EAAE;AAAK,CAAC;;AAE9F;AACA;AACA;AACA;;AA0BA,SAASC,WAAWA,CAACC,IAAY,EAAmB;EAClD,IAAIf,WAAW,CAACgB,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,KAAK;EACxC,IAAId,aAAa,CAACe,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,OAAO;EAC5C,IAAIb,kBAAkB,CAACc,IAAI,CAACD,IAAI,CAAC,EAAE,OAAO,YAAY;EACtD;AACF;AAEA,SAASE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B,8DAA8DoB,KAAK,EACrE,CAAC;EACH;EAEA,MAAMmD,IAAc,GAAG,EAAE;EACzB,IAAIH,CAAC,GAAGtB,WAAW,CAACN,MAAM,GAAG,CAAC;EAC9B,OAAO4B,CAAC,IAAI,CAAC,EAAE;IACbG,IAAI,CAACrC,IAAI,CAACY,WAAW,CAACsB,CAAC,CAAC,CAAEjB,GAAG,CAAC;IAC9BiB,CAAC,GAAGJ,WAAW,CAACI,CAAC,CAAE;EACrB;EAEA,OAAOxC,WAAW,CAACC,IAAI,EAAE0C,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC;AAC1C","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ const DOWNLOAD_EVENT_ENDPOINT = 'https://ai.swmansion.com/telemetry/downloads/ap
|
|
|
12
12
|
// self-referencing import would need package `exports` support in the consuming
|
|
13
13
|
// bundler to load at all. A wrong value here is analytics noise; a failed
|
|
14
14
|
// import would break the bundle.
|
|
15
|
-
const LIB_VERSION = '0.10.
|
|
15
|
+
const LIB_VERSION = '0.10.5';
|
|
16
16
|
|
|
17
17
|
// Anonymous analytics are on by default; apps opt out via setTelemetryEnabled.
|
|
18
18
|
let telemetryEnabled = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textPartitioner.d.ts","sourceRoot":"","sources":["../../../../../../src/extensions/speech/utils/textPartitioner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;OAIG;IACH,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAE7C;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE;QAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH,CAAC;AAqCF;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"textPartitioner.d.ts","sourceRoot":"","sources":["../../../../../../src/extensions/speech/utils/textPartitioner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;OAIG;IACH,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAE7C;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE;QAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;CACH,CAAC;AAqCF;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAqH3F"}
|
package/package.json
CHANGED
|
@@ -209,11 +209,9 @@ Pod::Spec.new do |s|
|
|
|
209
209
|
|
|
210
210
|
# --- Link flags ---
|
|
211
211
|
physical_ldflags = [
|
|
212
|
-
'$(inherited)',
|
|
213
212
|
"\"#{executorch_binaries_path}/libthreadpool_ios.a\"",
|
|
214
213
|
]
|
|
215
214
|
simulator_ldflags = [
|
|
216
|
-
'$(inherited)',
|
|
217
215
|
"\"#{executorch_binaries_path}/libthreadpool_simulator.a\"",
|
|
218
216
|
]
|
|
219
217
|
|
|
@@ -239,9 +237,10 @@ Pod::Spec.new do |s|
|
|
|
239
237
|
end
|
|
240
238
|
|
|
241
239
|
s.user_target_xcconfig = {
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
|
|
240
|
+
"RNE_OTHER_LDFLAGS[sdk=iphoneos*]" => physical_ldflags.join(' '),
|
|
241
|
+
"RNE_OTHER_LDFLAGS[sdk=iphonesimulator*]" => simulator_ldflags.join(' '),
|
|
242
|
+
"OTHER_LDFLAGS" => '$(inherited) $(RNE_OTHER_LDFLAGS)',
|
|
243
|
+
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'x86_64',
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
# iOS OpenCV is provided by a CocoaPod (not a downloaded tarball), normally
|
package/scripts/download-libs.js
CHANGED
|
@@ -76,7 +76,7 @@ const http = require('http');
|
|
|
76
76
|
const fs = require('fs');
|
|
77
77
|
const path = require('path');
|
|
78
78
|
const { spawnSync } = require('child_process');
|
|
79
|
-
const { createHash } = require('crypto');
|
|
79
|
+
const { createHash, randomBytes } = require('crypto');
|
|
80
80
|
const { Buffer } = require('buffer');
|
|
81
81
|
|
|
82
82
|
// ---- Config ----------------------------------------------------------------
|
|
@@ -324,16 +324,16 @@ function warnAboutPlatformAsymmetry({ backends }, targets) {
|
|
|
324
324
|
|
|
325
325
|
// ---- Target detection ------------------------------------------------------
|
|
326
326
|
|
|
327
|
+
// The iOS artifacts come down on every host, not only on macOS. Expo's
|
|
328
|
+
// fingerprint runtime version hashes the whole package root for both platforms,
|
|
329
|
+
// so a Mac install that held them and a Linux EAS builder that did not computed
|
|
330
|
+
// different Android runtime versions (#1509). They are ~10 MB compressed.
|
|
327
331
|
function detectTargets() {
|
|
328
332
|
if (process.env.RNET_TARGET) {
|
|
329
333
|
return [process.env.RNET_TARGET];
|
|
330
334
|
}
|
|
331
335
|
|
|
332
|
-
const targets = [];
|
|
333
|
-
if (process.platform === 'darwin') {
|
|
334
|
-
targets.push('ios');
|
|
335
|
-
}
|
|
336
|
-
targets.push('android-arm64-v8a');
|
|
336
|
+
const targets = ['ios', 'android-arm64-v8a'];
|
|
337
337
|
if (!process.env.RNET_NO_X86_64) {
|
|
338
338
|
targets.push('android-x86_64');
|
|
339
339
|
}
|
|
@@ -414,34 +414,59 @@ function ensureDir(dir) {
|
|
|
414
414
|
fs.mkdirSync(dir, { recursive: true });
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
+
// Writes to a temp file beside `dest` and renames it into place once complete.
|
|
418
|
+
// Package managers can run this postinstall for several copies of the package
|
|
419
|
+
// at once (a monorepo whose workspaces resolve it with different peers), all
|
|
420
|
+
// sharing CACHE_DIR. Writing `dest` directly let one copy truncate a checksum
|
|
421
|
+
// or tarball while another was reading it. The rename is atomic, so a reader
|
|
422
|
+
// sees either the previous file or the complete new one.
|
|
417
423
|
function download(url, dest) {
|
|
424
|
+
const tmp = `${dest}.${process.pid}-${randomBytes(4).toString('hex')}.tmp`;
|
|
418
425
|
return new Promise((resolve, reject) => {
|
|
419
|
-
const file = fs.createWriteStream(
|
|
426
|
+
const file = fs.createWriteStream(tmp);
|
|
427
|
+
const fail = (err) => {
|
|
428
|
+
// Close before removing: on Windows an open handle makes the unlink fail
|
|
429
|
+
// with EBUSY, which then replaces the real error with the cleanup's. And
|
|
430
|
+
// `force` covers the case where the file was never created. Rejects only
|
|
431
|
+
// once the temp file is gone, so a failed download leaves nothing behind.
|
|
432
|
+
file.close(() => {
|
|
433
|
+
fs.rmSync(tmp, { force: true });
|
|
434
|
+
reject(err);
|
|
435
|
+
});
|
|
436
|
+
};
|
|
420
437
|
const get = (currentUrl) => {
|
|
421
438
|
const client = currentUrl.startsWith('http://') ? http : https;
|
|
422
439
|
const headers = {};
|
|
423
440
|
if (process.env.GITHUB_TOKEN && currentUrl.includes('github.com')) {
|
|
424
441
|
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
|
425
442
|
}
|
|
426
|
-
client
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
443
|
+
client
|
|
444
|
+
.get(currentUrl, { headers }, (res) => {
|
|
445
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
446
|
+
res.resume();
|
|
447
|
+
return get(res.headers.location);
|
|
448
|
+
}
|
|
449
|
+
if (res.statusCode !== 200) {
|
|
450
|
+
res.resume();
|
|
451
|
+
return fail(new Error(`HTTP ${res.statusCode} for ${currentUrl}`));
|
|
452
|
+
}
|
|
453
|
+
res.pipe(file);
|
|
454
|
+
file.on('finish', () =>
|
|
455
|
+
file.close((err) => {
|
|
456
|
+
if (err) return fail(err);
|
|
457
|
+
try {
|
|
458
|
+
fs.renameSync(tmp, dest);
|
|
459
|
+
resolve();
|
|
460
|
+
} catch (renameErr) {
|
|
461
|
+
fail(renameErr);
|
|
462
|
+
}
|
|
463
|
+
})
|
|
464
|
+
);
|
|
465
|
+
})
|
|
466
|
+
.on('error', fail);
|
|
436
467
|
};
|
|
437
468
|
get(url);
|
|
438
|
-
file.on('error',
|
|
439
|
-
// Close before removing: on Windows an open handle makes the unlink fail
|
|
440
|
-
// with EBUSY, which then replaces the real error with the cleanup's. And
|
|
441
|
-
// `force` covers the case where the file was never created.
|
|
442
|
-
file.close(() => fs.rmSync(dest, { force: true }));
|
|
443
|
-
reject(err);
|
|
444
|
-
});
|
|
469
|
+
file.on('error', fail);
|
|
445
470
|
});
|
|
446
471
|
}
|
|
447
472
|
|
|
@@ -546,6 +571,17 @@ function expandPattern(root, pattern) {
|
|
|
546
571
|
return candidates.filter((candidate) => fs.existsSync(candidate));
|
|
547
572
|
}
|
|
548
573
|
|
|
574
|
+
function removeAppleDoubleFiles(dir) {
|
|
575
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
576
|
+
const entryPath = path.join(dir, entry.name);
|
|
577
|
+
if (entry.name.startsWith('._')) {
|
|
578
|
+
fs.rmSync(entryPath, { recursive: true, force: true });
|
|
579
|
+
} else if (entry.isDirectory()) {
|
|
580
|
+
removeAppleDoubleFiles(entryPath);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
549
585
|
function extract(tarball, destDir) {
|
|
550
586
|
ensureDir(destDir);
|
|
551
587
|
// `-m` stamps extracted files with the extraction time instead of the mtime
|
|
@@ -639,6 +675,8 @@ async function main() {
|
|
|
639
675
|
console.log(` ✓ Done`);
|
|
640
676
|
}
|
|
641
677
|
|
|
678
|
+
removeAppleDoubleFiles(THIRD_PARTY_DIR);
|
|
679
|
+
|
|
642
680
|
// Belt and braces to core no longer carrying backends: this also clears
|
|
643
681
|
// binaries left by an EARLIER install that had the backend enabled.
|
|
644
682
|
pruneDisabledBackends(targets, config);
|
|
@@ -658,10 +696,13 @@ module.exports = {
|
|
|
658
696
|
ALL_BACKENDS,
|
|
659
697
|
ALL_LIBS,
|
|
660
698
|
BACKEND_FILES,
|
|
699
|
+
detectTargets,
|
|
661
700
|
FEATURE_MAP,
|
|
662
701
|
findUserConfig,
|
|
663
702
|
readUserConfig,
|
|
664
703
|
pruneDisabledBackends,
|
|
704
|
+
removeAppleDoubleFiles,
|
|
665
705
|
sha256,
|
|
666
706
|
extract,
|
|
707
|
+
download,
|
|
667
708
|
};
|
|
@@ -7,8 +7,8 @@ import { RnExecuTorchError } from '../../../core/error';
|
|
|
7
7
|
type Tag = 'eos' | 'pause' | 'whitespace';
|
|
8
8
|
|
|
9
9
|
// Punctuation Regex Patterns
|
|
10
|
-
const EOS_PATTERN = /[
|
|
11
|
-
const PAUSE_PATTERN = /[,:\u2014\u00AB\u00BB]/;
|
|
10
|
+
const EOS_PATTERN = /[.?!;…|।॥¿¡。.!?;]/;
|
|
11
|
+
const PAUSE_PATTERN = /[,:\u2014\u00AB\u00BB、,:〜~]/;
|
|
12
12
|
const WHITESPACE_PATTERN = /\s/;
|
|
13
13
|
|
|
14
14
|
// Standard Partitioning Constants
|
|
@@ -124,9 +124,18 @@ export function partition(text: string, limit: number, options?: PartitionOption
|
|
|
124
124
|
|
|
125
125
|
const breakpoints: { idx: number; tag: Tag }[] = [];
|
|
126
126
|
let charIdx = 0;
|
|
127
|
+
let lastBpIdx = -1;
|
|
127
128
|
for (const char of text) {
|
|
129
|
+
const endIdx = charIdx + char.length - 1;
|
|
128
130
|
const t = tagFromChar(char);
|
|
129
|
-
if (
|
|
131
|
+
if (endIdx - lastBpIdx > limit) {
|
|
132
|
+
breakpoints.push({ idx: charIdx - 1, tag: 'whitespace' });
|
|
133
|
+
lastBpIdx = charIdx - 1;
|
|
134
|
+
}
|
|
135
|
+
if (t) {
|
|
136
|
+
breakpoints.push({ idx: endIdx, tag: t });
|
|
137
|
+
lastBpIdx = endIdx;
|
|
138
|
+
}
|
|
130
139
|
charIdx += char.length;
|
|
131
140
|
}
|
|
132
141
|
|
package/src/fetcher/telemetry.ts
CHANGED
|
@@ -10,7 +10,7 @@ const DOWNLOAD_EVENT_ENDPOINT = 'https://ai.swmansion.com/telemetry/downloads/ap
|
|
|
10
10
|
// self-referencing import would need package `exports` support in the consuming
|
|
11
11
|
// bundler to load at all. A wrong value here is analytics noise; a failed
|
|
12
12
|
// import would break the bundle.
|
|
13
|
-
const LIB_VERSION = '0.10.
|
|
13
|
+
const LIB_VERSION = '0.10.5';
|
|
14
14
|
|
|
15
15
|
// Anonymous analytics are on by default; apps opt out via setTelemetryEnabled.
|
|
16
16
|
let telemetryEnabled = true;
|
package/third-party/README.md
CHANGED
|
@@ -16,7 +16,8 @@ Native ExecuTorch artifacts are split into **committed source** and
|
|
|
16
16
|
`scripts/download-libs.js` runs at **postinstall** and downloads the prebuilt
|
|
17
17
|
binaries from this repo's GitHub Releases (tag `v<package version>`), based on the
|
|
18
18
|
app's opted-in `backends` / `libs` / `features` (see the getting-started docs).
|
|
19
|
-
|
|
19
|
+
Both platforms' binaries are fetched on every host, so the package contents (and
|
|
20
|
+
Expo's fingerprint) do not depend on the OS that ran the install. It writes `rne-build-config.json`, which the podspec and `android/build.gradle.kts`
|
|
20
21
|
read to gate `RNE_ENABLE_*` and link only the requested backends.
|
|
21
22
|
|
|
22
23
|
Extracted layout the podspec / `android/CMakeLists.txt` expect:
|