diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..e4a4fff --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry = "https://registry.npmjs.org" \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 5d1a07d..e3f99af 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a8f9856..5042b68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-update-cli", - "version": "1.32.3", + "version": "1.33.0", "description": "Command tools for javaScript updater with `pushy` service for react native apps.", "main": "index.js", "bin": { diff --git a/src/bundle.js b/src/bundle.js index b8c60e1..1d9e12c 100644 --- a/src/bundle.js +++ b/src/bundle.js @@ -226,6 +226,10 @@ async function compileHermesByteCode( '-O', ]; if (sourcemapOutput) { + fs.copyFileSync( + sourcemapOutput, + path.join(outputFolder, bundleName + '.txt.map'), + ); args.push('-output-source-map'); } console.log( @@ -234,6 +238,28 @@ async function compileHermesByteCode( spawnSync(hermesCommand, args, { stdio: 'ignore', }); + if (sourcemapOutput) { + const composerPath = + 'node_modules/react-native/scripts/compose-source-maps.js'; + if (!fs.existsSync(composerPath)) { + return; + } + console.log(`Composing source map`); + spawnSync( + 'node', + [ + composerPath, + path.join(outputFolder, bundleName + '.txt.map'), + path.join(outputFolder, bundleName + '.map'), + '-o', + sourcemapOutput, + ], + { + stdio: 'ignore', + }, + ); + } + fs.removeSync(path.join(outputFolder, bundleName + '.txt.map')); } async function pack(dir, output) {