@gfean/react-native-bundle-drop 0.2.1 → 0.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.
@@ -101,6 +101,31 @@ console.log(`đŸ“Ļ Bundling React Native code for platform: ${platform}...`);
101
101
  --bundle-output ${bundlePath} \
102
102
  --assets-dest ${assetsDir}`, { stdio: 'inherit' });
103
103
  console.log('✅ Bundle created:', bundlePath);
104
+ // đŸ”Ĩ Compile to Hermes bytecode if hermesc is available.
105
+ // The presence of the hermesc binary is the most reliable indicator that the
106
+ // project uses Hermes — config flag locations vary across RN versions.
107
+ // If hermesc is not found, the plain JS bundle is used (works on JSC).
108
+ const osBin = process.platform === 'darwin' ? 'osx-bin' : process.platform === 'win32' ? 'win64-bin' : 'linux64-bin';
109
+ const hermesLocations = [
110
+ path.join(projectRoot, 'node_modules', 'react-native', 'sdks', 'hermesc', osBin, 'hermesc'),
111
+ path.join(projectRoot, 'node_modules', 'hermes-engine', osBin, 'hermesc'),
112
+ ];
113
+ const hermescPath = hermesLocations.find(p => fs.existsSync(p));
114
+ if (hermescPath) {
115
+ console.log(`đŸ”Ĩ Compiling to Hermes bytecode (${platform})...`);
116
+ const hbcPath = bundlePath + '.hbc';
117
+ try {
118
+ (0, child_process_1.execSync)(`"${hermescPath}" -emit-binary -out "${hbcPath}" "${bundlePath}"`, { stdio: 'inherit' });
119
+ fs.renameSync(hbcPath, bundlePath);
120
+ console.log('✅ Hermes bytecode compiled successfully');
121
+ }
122
+ catch (e) {
123
+ console.warn('âš ī¸ Hermes compilation failed, falling back to plain JS bundle:', e.message);
124
+ }
125
+ }
126
+ else {
127
+ console.log('â„šī¸ hermesc not found — bundling plain JS (JSC or older RN)');
128
+ }
104
129
  // 📎 Create metadata
105
130
  const bundleBuffer = fs.readFileSync(bundlePath);
106
131
  const hash = (0, crypto_1.createHash)('sha256').update(bundleBuffer).digest('hex');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gfean/react-native-bundle-drop",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "react native ota by gFean",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",