Skip to content

Commit 3f68fa0

Browse files
author
sunny.luo
committed
compose sourcemap
1 parent fa750ba commit 3f68fa0

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry = "https://registry.npmjs.org"

bun.lockb

0 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update-cli",
3-
"version": "1.32.3",
3+
"version": "1.33.0",
44
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
55
"main": "index.js",
66
"bin": {

src/bundle.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ async function compileHermesByteCode(
226226
'-O',
227227
];
228228
if (sourcemapOutput) {
229+
fs.copyFileSync(
230+
sourcemapOutput,
231+
path.join(outputFolder, bundleName + '.txt.map'),
232+
);
229233
args.push('-output-source-map');
230234
}
231235
console.log(
@@ -234,6 +238,28 @@ async function compileHermesByteCode(
234238
spawnSync(hermesCommand, args, {
235239
stdio: 'ignore',
236240
});
241+
if (sourcemapOutput) {
242+
const composerPath =
243+
'node_modules/react-native/scripts/compose-source-maps.js';
244+
if (!fs.existsSync(composerPath)) {
245+
return;
246+
}
247+
console.log(`Composing source map`);
248+
spawnSync(
249+
'node',
250+
[
251+
composerPath,
252+
path.join(outputFolder, bundleName + '.txt.map'),
253+
path.join(outputFolder, bundleName + '.map'),
254+
'-o',
255+
sourcemapOutput,
256+
],
257+
{
258+
stdio: 'ignore',
259+
},
260+
);
261+
}
262+
fs.removeSync(path.join(outputFolder, bundleName + '.txt.map'));
237263
}
238264

239265
async function pack(dir, output) {

0 commit comments

Comments
 (0)