pulse-updates 1.2.1 → 1.2.2
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/package.json +1 -1
- package/scripts/publish.mjs +19 -3
package/package.json
CHANGED
package/scripts/publish.mjs
CHANGED
|
@@ -1174,20 +1174,36 @@ export function findLatestGeneratedAndroidCapabilitySource(projectRoot = process
|
|
|
1174
1174
|
if (!fs.existsSync(buildRoot)) return null;
|
|
1175
1175
|
|
|
1176
1176
|
const candidates = [];
|
|
1177
|
+
const variantOf = (candidatePath) => {
|
|
1178
|
+
const normal = candidatePath.replaceAll('\\', '/');
|
|
1179
|
+
return normal.match(/\/react\/([^/]+)\/index\.android\.bundle/)?.[1]
|
|
1180
|
+
|| normal.match(/\/intermediates\/assets\/([^/]+)\//)?.[1]
|
|
1181
|
+
|| null;
|
|
1182
|
+
};
|
|
1177
1183
|
const visit = (directory) => {
|
|
1178
1184
|
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
1179
1185
|
const fullPath = path.join(directory, entry.name);
|
|
1180
1186
|
if (entry.isDirectory()) visit(fullPath);
|
|
1181
1187
|
else if (entry.isFile() && entry.name === 'index.android.bundle.packager.map') {
|
|
1182
|
-
candidates.push({ path: fullPath, modifiedAt: fs.statSync(fullPath).mtimeMs });
|
|
1188
|
+
candidates.push({ path: fullPath, modifiedAt: fs.statSync(fullPath).mtimeMs, map: true, variant: variantOf(fullPath) });
|
|
1183
1189
|
} else if (entry.isFile() && entry.name === 'index.android.bundle' && !isHermesBytecode(fullPath)) {
|
|
1184
|
-
candidates.push({ path: fullPath, modifiedAt: fs.statSync(fullPath).mtimeMs });
|
|
1190
|
+
candidates.push({ path: fullPath, modifiedAt: fs.statSync(fullPath).mtimeMs, map: false, variant: variantOf(fullPath) });
|
|
1185
1191
|
}
|
|
1186
1192
|
}
|
|
1187
1193
|
};
|
|
1188
1194
|
visit(buildRoot);
|
|
1189
1195
|
candidates.sort((a, b) => b.modifiedAt - a.modifiedAt);
|
|
1190
|
-
|
|
1196
|
+
const latest = candidates[0];
|
|
1197
|
+
if (!latest) return null;
|
|
1198
|
+
|
|
1199
|
+
// Gradle writes the minified bundle after its packager map. Choosing only by mtime therefore
|
|
1200
|
+
// selects the bundle, where R8/Metro have erased the canonical native binding call sites, and
|
|
1201
|
+
// reports a dangerous empty capability set. For the newest build variant, the packager map is
|
|
1202
|
+
// authoritative because it retains every original module in sourcesContent.
|
|
1203
|
+
const matchingMap = latest.variant
|
|
1204
|
+
? candidates.find((candidate) => candidate.map && candidate.variant === latest.variant)
|
|
1205
|
+
: null;
|
|
1206
|
+
return matchingMap?.path || latest.path;
|
|
1191
1207
|
}
|
|
1192
1208
|
|
|
1193
1209
|
|