@react-native-community/cli-hermes
Advanced tools
Comparing version 11.4.0 to 11.4.1
@@ -13,3 +13,3 @@ import { Config } from '@react-native-community/cli-types'; | ||
*/ | ||
export declare function downloadProfile(ctx: Config, dstPath: string, filename?: string, sourcemapPath?: string, raw?: boolean, shouldGenerateSourcemap?: boolean, port?: string, appId?: string, appIdSuffix?: string): Promise<void>; | ||
export declare function downloadProfile(ctx: Config, dstPath: string, filename?: string, sourcemapPath?: string, raw?: boolean, shouldGenerateSourcemap?: boolean, port?: string, appId?: string, appIdSuffix?: string, host?: string): Promise<void>; | ||
//# sourceMappingURL=downloadProfile.d.ts.map |
@@ -57,2 +57,3 @@ "use strict"; | ||
} | ||
var _metroBundleOptions = require("./metroBundleOptions"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -88,3 +89,3 @@ /** | ||
*/ | ||
async function downloadProfile(ctx, dstPath, filename, sourcemapPath, raw, shouldGenerateSourcemap, port, appId, appIdSuffix) { | ||
async function downloadProfile(ctx, dstPath, filename, sourcemapPath, raw, shouldGenerateSourcemap, port = '8081', appId, appIdSuffix, host = 'localhost') { | ||
try { | ||
@@ -116,2 +117,4 @@ const androidProject = (0, _cliPlatformAndroid().getAndroidProject)(ctx); | ||
execSyncWithLog(`adb shell run-as ${packageNameWithSuffix} cat cache/${file} > ${tempFilePath}`); | ||
const bundleOptions = (0, _metroBundleOptions.getMetroBundleOptions)(tempFilePath, host); | ||
// If path to source map is not given | ||
@@ -121,5 +124,5 @@ if (!sourcemapPath) { | ||
if (shouldGenerateSourcemap) { | ||
sourcemapPath = await (0, _sourcemapUtils.generateSourcemap)(port); | ||
sourcemapPath = await (0, _sourcemapUtils.generateSourcemap)(port, bundleOptions); | ||
} else { | ||
sourcemapPath = await (0, _sourcemapUtils.findSourcemap)(ctx, port); | ||
sourcemapPath = await (0, _sourcemapUtils.findSourcemap)(ctx, port, bundleOptions); | ||
} | ||
@@ -126,0 +129,0 @@ |
@@ -10,2 +10,3 @@ import { Config } from '@react-native-community/cli-types'; | ||
appIdSuffix?: string; | ||
host?: string; | ||
}; | ||
@@ -25,2 +26,6 @@ declare function profileHermes([dstPath]: Array<string>, ctx: Config, options: Options): Promise<void>; | ||
description?: undefined; | ||
} | { | ||
name: string; | ||
description: string; | ||
default: string; | ||
})[]; | ||
@@ -27,0 +32,0 @@ examples: { |
@@ -21,3 +21,3 @@ "use strict"; | ||
} | ||
await (0, _downloadProfile.downloadProfile)(ctx, dstPath, options.filename, options.sourcemapPath, options.raw, options.generateSourcemap, options.port, options.appId, options.appIdSuffix); | ||
await (0, _downloadProfile.downloadProfile)(ctx, dstPath, options.filename, options.sourcemapPath, options.raw, options.generateSourcemap, options.port, options.appId, options.appIdSuffix, options.host); | ||
} catch (err) { | ||
@@ -52,2 +52,6 @@ throw err; | ||
description: 'Specify an applicationIdSuffix to launch after build.' | ||
}, { | ||
name: '--host <string>', | ||
description: 'The host of the packager.', | ||
default: 'localhost' | ||
}], | ||
@@ -54,0 +58,0 @@ examples: [{ |
import { Config } from '@react-native-community/cli-types'; | ||
import { MetroBundleOptions } from './metroBundleOptions'; | ||
/** | ||
* Generate a sourcemap by fetching it from a running metro server | ||
*/ | ||
export declare function generateSourcemap(port?: string): Promise<string | undefined>; | ||
export declare function generateSourcemap(port: string, bundleOptions: MetroBundleOptions): Promise<string | undefined>; | ||
/** | ||
@@ -10,3 +11,3 @@ * | ||
*/ | ||
export declare function findSourcemap(ctx: Config, port?: string): Promise<string | undefined>; | ||
export declare function findSourcemap(ctx: Config, port: string, bundleOptions: MetroBundleOptions): Promise<string | undefined>; | ||
//# sourceMappingURL=sourcemapUtils.d.ts.map |
@@ -36,9 +36,2 @@ "use strict"; | ||
} | ||
function _ip() { | ||
const data = _interopRequireDefault(require("ip")); | ||
_ip = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -61,8 +54,11 @@ function getTempFilePath(filename) { | ||
} | ||
async function getSourcemapFromServer(port) { | ||
async function getSourcemapFromServer(port, { | ||
platform, | ||
dev, | ||
minify, | ||
host | ||
}) { | ||
_cliTools().logger.debug('Getting source maps from Metro packager server'); | ||
const DEBUG_SERVER_PORT = port || '8081'; | ||
const IP_ADDRESS = _ip().default.address(); | ||
const PLATFORM = 'android'; | ||
const requestURL = `http://${IP_ADDRESS}:${DEBUG_SERVER_PORT}/index.map?platform=${PLATFORM}&dev=true`; | ||
const requestURL = `http://${host}:${port}/index.map?platform=${platform}&dev=${dev}&minify=${minify}`; | ||
_cliTools().logger.debug(`Downloading from ${requestURL}`); | ||
try { | ||
@@ -82,6 +78,6 @@ const { | ||
*/ | ||
async function generateSourcemap(port) { | ||
async function generateSourcemap(port, bundleOptions) { | ||
// Fetch the source map to a temp directory | ||
const sourceMapPath = getTempFilePath('index.map'); | ||
const sourceMapResult = await getSourcemapFromServer(port); | ||
const sourceMapResult = await getSourcemapFromServer(port, bundleOptions); | ||
if (sourceMapResult) { | ||
@@ -102,3 +98,3 @@ _cliTools().logger.debug('Using source maps from Metro packager server'); | ||
*/ | ||
async function findSourcemap(ctx, port) { | ||
async function findSourcemap(ctx, port, bundleOptions) { | ||
const intermediateBuildPath = _path().default.join(ctx.root, 'android', 'app', 'build', 'intermediates', 'sourcemaps', 'react', 'debug', 'index.android.bundle.packager.map'); | ||
@@ -113,3 +109,3 @@ const generatedBuildPath = _path().default.join(ctx.root, 'android', 'app', 'build', 'generated', 'sourcemaps', 'react', 'debug', 'index.android.bundle.map'); | ||
} else { | ||
return generateSourcemap(port); | ||
return generateSourcemap(port, bundleOptions); | ||
} | ||
@@ -116,0 +112,0 @@ } |
{ | ||
"name": "@react-native-community/cli-hermes", | ||
"version": "11.4.0", | ||
"version": "11.4.1", | ||
"license": "MIT", | ||
@@ -11,7 +11,6 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@react-native-community/cli-platform-android": "11.4.0", | ||
"@react-native-community/cli-tools": "11.4.0", | ||
"@react-native-community/cli-platform-android": "11.4.1", | ||
"@react-native-community/cli-tools": "11.4.1", | ||
"chalk": "^4.1.2", | ||
"hermes-profile-transformer": "^0.0.6", | ||
"ip": "^1.1.5" | ||
"hermes-profile-transformer": "^0.0.6" | ||
}, | ||
@@ -24,3 +23,3 @@ "files": [ | ||
"devDependencies": { | ||
"@react-native-community/cli-types": "11.4.0", | ||
"@react-native-community/cli-types": "11.4.1", | ||
"@types/ip": "^1.1.0" | ||
@@ -34,3 +33,3 @@ }, | ||
}, | ||
"gitHead": "96204cb61e6f4226903869163462d2484f1599db" | ||
"gitHead": "bf17602f002313980865fc5557fac32923fcd1bd" | ||
} |
@@ -60,2 +60,8 @@ # @react-native-community/cli-hermes | ||
#### `--host <string>` | ||
The host of the packager. | ||
> default: localhost | ||
### Notes on source map | ||
@@ -62,0 +68,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43153
4
23
441
71
4
+ Added@react-native-community/cli-platform-android@11.4.1(transitive)
+ Added@react-native-community/cli-tools@11.4.1(transitive)
- Removedip@^1.1.5
- Removed@react-native-community/cli-platform-android@11.4.0(transitive)
- Removed@react-native-community/cli-tools@11.4.0(transitive)
- Removedip@1.1.9(transitive)