pulse-updates 1.0.9 → 1.0.10
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 +18 -4
package/package.json
CHANGED
package/scripts/publish.mjs
CHANGED
|
@@ -68,6 +68,19 @@ async function hashFileMD5(filePath) {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Check if file is Hermes bytecode by reading magic number
|
|
73
|
+
*/
|
|
74
|
+
function isHermesBytecode(filePath) {
|
|
75
|
+
const fd = fs.openSync(filePath, 'r');
|
|
76
|
+
const buffer = Buffer.alloc(4);
|
|
77
|
+
fs.readSync(fd, buffer, 0, 4, 0);
|
|
78
|
+
fs.closeSync(fd);
|
|
79
|
+
// Hermes magic number: 0xc61fbc03
|
|
80
|
+
return buffer[0] === 0xc6 && buffer[1] === 0x1f && buffer[2] === 0xbc && buffer[3] === 0x03;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
71
84
|
/**
|
|
72
85
|
* Get MIME type from file extension
|
|
73
86
|
*/
|
|
@@ -207,16 +220,17 @@ async function collectAssets(bundleDir, platform) {
|
|
|
207
220
|
throw new Error(`Bundle not found: ${bundlePath}`);
|
|
208
221
|
}
|
|
209
222
|
|
|
210
|
-
// Add launch asset (JS bundle)
|
|
223
|
+
// Add launch asset (JS bundle or Hermes bytecode)
|
|
211
224
|
const bundleHash = await hashFileSHA256(bundlePath);
|
|
212
225
|
const bundleStats = fs.statSync(bundlePath);
|
|
226
|
+
const isHbc = isHermesBytecode(bundlePath);
|
|
213
227
|
|
|
214
228
|
assets.push({
|
|
215
229
|
path: bundlePath,
|
|
216
|
-
key: 'bundle.js',
|
|
230
|
+
key: isHbc ? 'bundle.hbc' : 'bundle.js',
|
|
217
231
|
hash: bundleHash,
|
|
218
|
-
contentType: 'application/javascript',
|
|
219
|
-
fileExtension: '.js',
|
|
232
|
+
contentType: isHbc ? 'application/octet-stream' : 'application/javascript',
|
|
233
|
+
fileExtension: isHbc ? '.hbc' : '.js',
|
|
220
234
|
fileSize: bundleStats.size,
|
|
221
235
|
isLaunchAsset: true,
|
|
222
236
|
});
|