1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 01:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

compose sourcemap

This commit is contained in:
sunny.luo
2024-11-19 23:26:48 +08:00
parent fa750ba157
commit 3f68fa0f11
4 changed files with 28 additions and 1 deletions

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
registry = "https://registry.npmjs.org"

BIN
bun.lockb

Binary file not shown.

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update-cli", "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.", "description": "Command tools for javaScript updater with `pushy` service for react native apps.",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@@ -226,6 +226,10 @@ async function compileHermesByteCode(
'-O', '-O',
]; ];
if (sourcemapOutput) { if (sourcemapOutput) {
fs.copyFileSync(
sourcemapOutput,
path.join(outputFolder, bundleName + '.txt.map'),
);
args.push('-output-source-map'); args.push('-output-source-map');
} }
console.log( console.log(
@@ -234,6 +238,28 @@ async function compileHermesByteCode(
spawnSync(hermesCommand, args, { spawnSync(hermesCommand, args, {
stdio: 'ignore', 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) { async function pack(dir, output) {