yeet
This commit is contained in:
17
node_modules/@react-native-community/cli-platform-android/build/commands/index.js
generated
vendored
Normal file
17
node_modules/@react-native-community/cli-platform-android/build/commands/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _logAndroid = _interopRequireDefault(require("./logAndroid"));
|
||||
|
||||
var _runAndroid = _interopRequireDefault(require("./runAndroid"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = [_logAndroid.default, _runAndroid.default];
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
57
node_modules/@react-native-community/cli-platform-android/build/commands/logAndroid/index.js
generated
vendored
Normal file
57
node_modules/@react-native-community/cli-platform-android/build/commands/logAndroid/index.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _logkitty() {
|
||||
const data = require("logkitty");
|
||||
|
||||
_logkitty = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
async function logAndroid() {
|
||||
_cliTools().logger.info('Starting logkitty');
|
||||
|
||||
const emitter = (0, _logkitty().logkitty)({
|
||||
platform: 'android',
|
||||
priority: _logkitty().AndroidPriority.VERBOSE,
|
||||
filter: (0, _logkitty().makeTagsFilter)('ReactNative', 'ReactNativeJS')
|
||||
});
|
||||
emitter.on('entry', entry => {
|
||||
_cliTools().logger.log((0, _logkitty().formatEntry)(entry));
|
||||
});
|
||||
emitter.on('error', error => {
|
||||
_cliTools().logger.log((0, _logkitty().formatError)(error));
|
||||
});
|
||||
}
|
||||
|
||||
var _default = {
|
||||
name: 'log-android',
|
||||
description: 'starts logkitty',
|
||||
func: logAndroid
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
86
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/adb.js
generated
vendored
Normal file
86
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/adb.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _child_process() {
|
||||
const data = require("child_process");
|
||||
|
||||
_child_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parses the output of the 'adb devices' command
|
||||
*/
|
||||
function parseDevicesResult(result) {
|
||||
if (!result) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const devices = [];
|
||||
const lines = result.trim().split(/\r?\n/);
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const words = lines[i].split(/[ ,\t]+/).filter(w => w !== '');
|
||||
|
||||
if (words[1] === 'device') {
|
||||
devices.push(words[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
/**
|
||||
* Executes the commands needed to get a list of devices from ADB
|
||||
*/
|
||||
|
||||
|
||||
function getDevices(adbPath) {
|
||||
try {
|
||||
const devicesResult = (0, _child_process().execSync)(`${adbPath} devices`);
|
||||
return parseDevicesResult(devicesResult.toString());
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets available CPUs of devices from ADB
|
||||
*/
|
||||
|
||||
|
||||
function getAvailableCPUs(adbPath, device) {
|
||||
try {
|
||||
const baseArgs = ['-s', device, 'shell', 'getprop'];
|
||||
let cpus = (0, _child_process().execFileSync)(adbPath, baseArgs.concat(['ro.product.cpu.abilist'])).toString(); // pre-Lollipop
|
||||
|
||||
if (!cpus || cpus.trim().length === 0) {
|
||||
cpus = (0, _child_process().execFileSync)(adbPath, baseArgs.concat(['ro.product.cpu.abi'])).toString();
|
||||
}
|
||||
|
||||
return (cpus || '').trim().split(',');
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
var _default = {
|
||||
getDevices,
|
||||
getAvailableCPUs
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=adb.js.map
|
22
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/getAdbPath.js
generated
vendored
Normal file
22
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/getAdbPath.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function getAdbPath() {
|
||||
return process.env.ANDROID_HOME ? `${process.env.ANDROID_HOME}/platform-tools/adb` : 'adb';
|
||||
}
|
||||
|
||||
var _default = getAdbPath;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=getAdbPath.js.map
|
367
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js
generated
vendored
Normal file
367
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js
generated
vendored
Normal file
@ -0,0 +1,367 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _adb = _interopRequireDefault(require("./adb"));
|
||||
|
||||
var _runOnAllDevices = _interopRequireDefault(require("./runOnAllDevices"));
|
||||
|
||||
var _tryRunAdbReverse = _interopRequireDefault(require("./tryRunAdbReverse"));
|
||||
|
||||
var _tryLaunchAppOnDevice = _interopRequireDefault(require("./tryLaunchAppOnDevice"));
|
||||
|
||||
var _getAdbPath = _interopRequireDefault(require("./getAdbPath"));
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _warnAboutManuallyLinkedLibs = _interopRequireDefault(require("../../link/warnAboutManuallyLinkedLibs"));
|
||||
|
||||
var _getAndroidProject = require("../../utils/getAndroidProject");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function displayWarnings(config, args) {
|
||||
(0, _warnAboutManuallyLinkedLibs.default)(config);
|
||||
|
||||
if (args.appFolder) {
|
||||
_cliTools().logger.warn('Using deprecated "--appFolder" flag. Use "project.android.appName" in react-native.config.js instead.');
|
||||
}
|
||||
|
||||
if (args.root) {
|
||||
_cliTools().logger.warn('Using deprecated "--root" flag. App root is discovered automatically. Alternatively, set "project.android.sourceDir" in react-native.config.js.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the app on a connected Android emulator or device.
|
||||
*/
|
||||
async function runAndroid(_argv, config, args) {
|
||||
displayWarnings(config, args);
|
||||
const androidProject = (0, _getAndroidProject.getAndroidProject)(config);
|
||||
|
||||
if (args.jetifier) {
|
||||
_cliTools().logger.info(`Running ${_chalk().default.bold('jetifier')} to migrate libraries to AndroidX. ${_chalk().default.dim('You can disable it using "--no-jetifier" flag.')}`);
|
||||
|
||||
try {
|
||||
await (0, _execa().default)(require.resolve('jetifier/bin/jetify'), {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)('Failed to run jetifier.', error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!args.packager) {
|
||||
return buildAndRun(args, androidProject);
|
||||
}
|
||||
|
||||
return (0, _cliTools().isPackagerRunning)(args.port).then(result => {
|
||||
if (result === 'running') {
|
||||
_cliTools().logger.info('JS server already running.');
|
||||
} else if (result === 'unrecognized') {
|
||||
_cliTools().logger.warn('JS server not recognized, continuing with build...');
|
||||
} else {
|
||||
// result == 'not_running'
|
||||
_cliTools().logger.info('Starting JS server...');
|
||||
|
||||
try {
|
||||
startServerInNewWindow(args.port, args.terminal, config.reactNativePath);
|
||||
} catch (error) {
|
||||
_cliTools().logger.warn(`Failed to automatically start the packager server. Please run "react-native start" manually. Error details: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
return buildAndRun(args, androidProject);
|
||||
});
|
||||
} // Builds the app and runs it on a connected emulator / device.
|
||||
|
||||
|
||||
function buildAndRun(args, androidProject) {
|
||||
process.chdir(androidProject.sourceDir);
|
||||
const cmd = process.platform.startsWith('win') ? 'gradlew.bat' : './gradlew';
|
||||
const {
|
||||
appFolder
|
||||
} = args;
|
||||
const packageName = (0, _getAndroidProject.getPackageName)(androidProject, appFolder);
|
||||
const adbPath = (0, _getAdbPath.default)();
|
||||
|
||||
if (args.deviceId) {
|
||||
return runOnSpecificDevice(args, cmd, packageName, adbPath, androidProject);
|
||||
} else {
|
||||
return (0, _runOnAllDevices.default)(args, cmd, packageName, adbPath, androidProject);
|
||||
}
|
||||
}
|
||||
|
||||
function runOnSpecificDevice(args, gradlew, packageName, adbPath, androidProject) {
|
||||
const devices = _adb.default.getDevices(adbPath);
|
||||
|
||||
const {
|
||||
deviceId
|
||||
} = args;
|
||||
|
||||
if (devices.length > 0 && deviceId) {
|
||||
if (devices.indexOf(deviceId) !== -1) {
|
||||
buildApk(gradlew, androidProject.sourceDir);
|
||||
installAndLaunchOnDevice(args, deviceId, packageName, adbPath, androidProject);
|
||||
} else {
|
||||
_cliTools().logger.error(`Could not find device with the id: "${deviceId}". Please choose one of the following:`, ...devices);
|
||||
}
|
||||
} else {
|
||||
_cliTools().logger.error('No Android device or emulator connected.');
|
||||
}
|
||||
}
|
||||
|
||||
function buildApk(gradlew, sourceDir) {
|
||||
try {
|
||||
// using '-x lint' in order to ignore linting errors while building the apk
|
||||
const gradleArgs = ['build', '-x', 'lint'];
|
||||
|
||||
_cliTools().logger.info('Building the app...');
|
||||
|
||||
_cliTools().logger.debug(`Running command "${gradlew} ${gradleArgs.join(' ')}"`);
|
||||
|
||||
_execa().default.sync(gradlew, gradleArgs, {
|
||||
stdio: 'inherit',
|
||||
cwd: sourceDir
|
||||
});
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)('Failed to build the app.', error);
|
||||
}
|
||||
}
|
||||
|
||||
function tryInstallAppOnDevice(args, adbPath, device, androidProject) {
|
||||
try {
|
||||
// "app" is usually the default value for Android apps with only 1 app
|
||||
const {
|
||||
appName,
|
||||
sourceDir
|
||||
} = androidProject;
|
||||
const {
|
||||
appFolder
|
||||
} = args;
|
||||
const variant = args.variant.toLowerCase();
|
||||
const buildDirectory = `${sourceDir}/${appName}/build/outputs/apk/${variant}`;
|
||||
const apkFile = getInstallApkName(appFolder || appName, // TODO: remove appFolder
|
||||
adbPath, variant, device, buildDirectory);
|
||||
const pathToApk = `${buildDirectory}/${apkFile}`;
|
||||
const adbArgs = ['-s', device, 'install', '-r', '-d', pathToApk];
|
||||
|
||||
_cliTools().logger.info(`Installing the app on the device "${device}"...`);
|
||||
|
||||
_cliTools().logger.debug(`Running command "cd android && adb -s ${device} install -r -d ${pathToApk}"`);
|
||||
|
||||
_execa().default.sync(adbPath, adbArgs, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)('Failed to install the app on the device.', error);
|
||||
}
|
||||
}
|
||||
|
||||
function getInstallApkName(appName, adbPath, variant, device, buildDirectory) {
|
||||
const availableCPUs = _adb.default.getAvailableCPUs(adbPath, device); // check if there is an apk file like app-armeabi-v7a-debug.apk
|
||||
|
||||
|
||||
for (const availableCPU of availableCPUs.concat('universal')) {
|
||||
const apkName = `${appName}-${availableCPU}-${variant}.apk`;
|
||||
|
||||
if (_fs().default.existsSync(`${buildDirectory}/${apkName}`)) {
|
||||
return apkName;
|
||||
}
|
||||
} // check if there is a default file like app-debug.apk
|
||||
|
||||
|
||||
const apkName = `${appName}-${variant}.apk`;
|
||||
|
||||
if (_fs().default.existsSync(`${buildDirectory}/${apkName}`)) {
|
||||
return apkName;
|
||||
}
|
||||
|
||||
throw new (_cliTools().CLIError)('Could not find the correct install APK file.');
|
||||
}
|
||||
|
||||
function installAndLaunchOnDevice(args, selectedDevice, packageName, adbPath, androidProject) {
|
||||
(0, _tryRunAdbReverse.default)(args.port, selectedDevice);
|
||||
tryInstallAppOnDevice(args, adbPath, selectedDevice, androidProject);
|
||||
(0, _tryLaunchAppOnDevice.default)(selectedDevice, packageName, adbPath, args);
|
||||
}
|
||||
|
||||
function startServerInNewWindow(port, terminal, reactNativePath) {
|
||||
/**
|
||||
* Set up OS-specific filenames and commands
|
||||
*/
|
||||
const isWindows = /^win/.test(process.platform);
|
||||
const scriptFile = isWindows ? 'launchPackager.bat' : 'launchPackager.command';
|
||||
const packagerEnvFilename = isWindows ? '.packager.bat' : '.packager.env';
|
||||
const portExportContent = isWindows ? `set RCT_METRO_PORT=${port}` : `export RCT_METRO_PORT=${port}`;
|
||||
/**
|
||||
* Set up the `.packager.(env|bat)` file to ensure the packager starts on the right port.
|
||||
*/
|
||||
|
||||
const launchPackagerScript = _path().default.join(reactNativePath, `scripts/${scriptFile}`);
|
||||
/**
|
||||
* Set up the `launchpackager.(command|bat)` file.
|
||||
* It lives next to `.packager.(bat|env)`
|
||||
*/
|
||||
|
||||
|
||||
const scriptsDir = _path().default.dirname(launchPackagerScript);
|
||||
|
||||
const packagerEnvFile = _path().default.join(scriptsDir, packagerEnvFilename);
|
||||
|
||||
const procConfig = {
|
||||
cwd: scriptsDir
|
||||
};
|
||||
/**
|
||||
* Ensure we overwrite file by passing the `w` flag
|
||||
*/
|
||||
|
||||
_fs().default.writeFileSync(packagerEnvFile, portExportContent, {
|
||||
encoding: 'utf8',
|
||||
flag: 'w'
|
||||
});
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
try {
|
||||
return _execa().default.sync('open', ['-a', terminal, launchPackagerScript], procConfig);
|
||||
} catch (error) {
|
||||
return _execa().default.sync('open', [launchPackagerScript], procConfig);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
try {
|
||||
return _execa().default.sync(terminal, ['-e', `sh ${launchPackagerScript}`], { ...procConfig,
|
||||
detached: true
|
||||
});
|
||||
} catch (error) {
|
||||
// By default, the child shell process will be attached to the parent
|
||||
return _execa().default.sync('sh', [launchPackagerScript], procConfig);
|
||||
}
|
||||
}
|
||||
|
||||
if (/^win/.test(process.platform)) {
|
||||
// Awaiting this causes the CLI to hang indefinitely, so this must execute without await.
|
||||
return (0, _execa().default)('cmd.exe', ['/C', launchPackagerScript], { ...procConfig,
|
||||
detached: true,
|
||||
stdio: 'ignore'
|
||||
});
|
||||
}
|
||||
|
||||
_cliTools().logger.error(`Cannot start the packager. Unknown platform ${process.platform}`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var _default = {
|
||||
name: 'run-android',
|
||||
description: 'builds your app and starts it on a connected Android emulator or device',
|
||||
func: runAndroid,
|
||||
options: [{
|
||||
name: '--root [string]',
|
||||
description: '[DEPRECATED - root is discovered automatically] Override the root directory for the android build (which contains the android directory)',
|
||||
default: ''
|
||||
}, {
|
||||
name: '--variant [string]',
|
||||
description: "Specify your app's build variant",
|
||||
default: 'debug'
|
||||
}, {
|
||||
name: '--appFolder [string]',
|
||||
description: '[DEPRECATED – use "project.android.appName" in react-native.config.js] Specify a different application folder name for the android source. If not, we assume is "app"'
|
||||
}, {
|
||||
name: '--appId [string]',
|
||||
description: 'Specify an applicationId to launch after build. If not specified, `package` from AndroidManifest.xml will be used.',
|
||||
default: ''
|
||||
}, {
|
||||
name: '--appIdSuffix [string]',
|
||||
description: 'Specify an applicationIdSuffix to launch after build.',
|
||||
default: ''
|
||||
}, {
|
||||
name: '--main-activity [string]',
|
||||
description: 'Name of the activity to start',
|
||||
default: 'MainActivity'
|
||||
}, {
|
||||
name: '--deviceId [string]',
|
||||
description: 'builds your app and starts it on a specific device/simulator with the ' + 'given device id (listed by running "adb devices" on the command line).'
|
||||
}, {
|
||||
name: '--no-packager',
|
||||
description: 'Do not launch packager while building'
|
||||
}, {
|
||||
name: '--port [number]',
|
||||
default: process.env.RCT_METRO_PORT || 8081,
|
||||
parse: val => Number(val)
|
||||
}, {
|
||||
name: '--terminal [string]',
|
||||
description: 'Launches the Metro Bundler in a new window using the specified terminal path.',
|
||||
default: (0, _cliTools().getDefaultUserTerminal)()
|
||||
}, {
|
||||
name: '--tasks [list]',
|
||||
description: 'Run custom Gradle tasks. By default it\'s "installDebug"',
|
||||
parse: val => val.split(',')
|
||||
}, {
|
||||
name: '--no-jetifier',
|
||||
description: 'Do not run "jetifier" – the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don\'t support AndroidX yet. See more at: https://www.npmjs.com/package/jetifier.',
|
||||
default: false
|
||||
}]
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
129
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js
generated
vendored
Normal file
129
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js
generated
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _adb = _interopRequireDefault(require("./adb"));
|
||||
|
||||
var _tryRunAdbReverse = _interopRequireDefault(require("./tryRunAdbReverse"));
|
||||
|
||||
var _tryLaunchAppOnDevice = _interopRequireDefault(require("./tryLaunchAppOnDevice"));
|
||||
|
||||
var _tryLaunchEmulator = _interopRequireDefault(require("./tryLaunchEmulator"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function getTaskNames(appName, commands) {
|
||||
return appName ? commands.map(command => `${appName}:${command}`) : commands;
|
||||
}
|
||||
|
||||
function toPascalCase(value) {
|
||||
return value !== '' ? value[0].toUpperCase() + value.slice(1) : value;
|
||||
}
|
||||
|
||||
async function runOnAllDevices(args, cmd, packageName, adbPath, androidProject) {
|
||||
let devices = _adb.default.getDevices(adbPath);
|
||||
|
||||
if (devices.length === 0) {
|
||||
_cliTools().logger.info('Launching emulator...');
|
||||
|
||||
const result = await (0, _tryLaunchEmulator.default)(adbPath);
|
||||
|
||||
if (result.success) {
|
||||
_cliTools().logger.info('Successfully launched emulator.');
|
||||
|
||||
devices = _adb.default.getDevices(adbPath);
|
||||
} else {
|
||||
_cliTools().logger.error(`Failed to launch emulator. Reason: ${_chalk().default.dim(result.error || '')}.`);
|
||||
|
||||
_cliTools().logger.warn('Please launch an emulator manually or connect a device. Otherwise app may fail to launch.');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const tasks = args.tasks || ['install' + toPascalCase(args.variant)];
|
||||
const gradleArgs = getTaskNames(args.appFolder || androidProject.appName, tasks);
|
||||
|
||||
if (args.port != null) {
|
||||
gradleArgs.push('-PreactNativeDevServerPort=' + args.port);
|
||||
}
|
||||
|
||||
_cliTools().logger.info('Installing the app...');
|
||||
|
||||
_cliTools().logger.debug(`Running command "cd android && ${cmd} ${gradleArgs.join(' ')}"`);
|
||||
|
||||
await (0, _execa().default)(cmd, gradleArgs, {
|
||||
stdio: ['inherit', 'inherit', 'pipe'],
|
||||
cwd: androidProject.sourceDir
|
||||
});
|
||||
} catch (error) {
|
||||
throw createInstallError(error);
|
||||
}
|
||||
|
||||
(devices.length > 0 ? devices : [undefined]).forEach(device => {
|
||||
(0, _tryRunAdbReverse.default)(args.port, device);
|
||||
(0, _tryLaunchAppOnDevice.default)(device, packageName, adbPath, args);
|
||||
});
|
||||
}
|
||||
|
||||
function createInstallError(error) {
|
||||
const stderr = (error.stderr || '').toString();
|
||||
const docs = 'https://reactnative.dev/docs/environment-setup';
|
||||
let message = `Make sure you have the Android development environment set up: ${_chalk().default.underline.dim(docs)}`; // Pass the error message from the command to stdout because we pipe it to
|
||||
// parent process so it's not visible
|
||||
|
||||
_cliTools().logger.log(stderr); // Handle some common failures and make the errors more helpful
|
||||
|
||||
|
||||
if (stderr.includes('No connected devices')) {
|
||||
message = 'Make sure you have an Android emulator running or a device connected';
|
||||
} else if (stderr.includes('licences have not been accepted') || stderr.includes('accept the SDK license')) {
|
||||
message = `Please accept all necessary Android SDK licenses using Android SDK Manager: "${_chalk().default.bold('$ANDROID_HOME/tools/bin/sdkmanager --licenses')}"`;
|
||||
}
|
||||
|
||||
return new (_cliTools().CLIError)(`Failed to install the app. ${message}.`, error);
|
||||
}
|
||||
|
||||
var _default = runOnAllDevices;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=runOnAllDevices.js.map
|
69
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js
generated
vendored
Normal file
69
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchAppOnDevice.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function tryLaunchAppOnDevice(device, packageName, adbPath, args) {
|
||||
const {
|
||||
appId,
|
||||
appIdSuffix
|
||||
} = args;
|
||||
const packageNameWithSuffix = [appId || packageName, appIdSuffix].filter(Boolean).join('.');
|
||||
const activityToLaunch = args.mainActivity.includes('.') ? args.mainActivity : [packageName, args.mainActivity].filter(Boolean).join('.');
|
||||
|
||||
try {
|
||||
const adbArgs = ['shell', 'am', 'start', '-n', `${packageNameWithSuffix}/${activityToLaunch}`];
|
||||
|
||||
if (device) {
|
||||
adbArgs.unshift('-s', device);
|
||||
|
||||
_cliTools().logger.info(`Starting the app on "${device}"...`);
|
||||
} else {
|
||||
_cliTools().logger.info('Starting the app...');
|
||||
}
|
||||
|
||||
_cliTools().logger.debug(`Running command "${adbPath} ${adbArgs.join(' ')}"`);
|
||||
|
||||
_execa().default.sync(adbPath, adbArgs, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)('Failed to start the app.', error);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = tryLaunchAppOnDevice;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=tryLaunchAppOnDevice.js.map
|
103
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchEmulator.js
generated
vendored
Normal file
103
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryLaunchEmulator.js
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = tryLaunchEmulator;
|
||||
|
||||
function _os() {
|
||||
const data = _interopRequireDefault(require("os"));
|
||||
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _adb = _interopRequireDefault(require("./adb"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const emulatorCommand = process.env.ANDROID_HOME ? `${process.env.ANDROID_HOME}/emulator/emulator` : 'emulator';
|
||||
|
||||
const getEmulators = () => {
|
||||
try {
|
||||
const emulatorsOutput = _execa().default.sync(emulatorCommand, ['-list-avds']).stdout;
|
||||
|
||||
return emulatorsOutput.split(_os().default.EOL).filter(name => name !== '');
|
||||
} catch (_unused) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
const launchEmulator = async (emulatorName, adbPath) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cp = (0, _execa().default)(emulatorCommand, [`@${emulatorName}`], {
|
||||
detached: true,
|
||||
stdio: 'ignore'
|
||||
});
|
||||
cp.unref();
|
||||
const timeout = 30; // Reject command after timeout
|
||||
|
||||
const rejectTimeout = setTimeout(() => {
|
||||
cleanup();
|
||||
reject(`Could not start emulator within ${timeout} seconds.`);
|
||||
}, timeout * 1000);
|
||||
const bootCheckInterval = setInterval(() => {
|
||||
if (_adb.default.getDevices(adbPath).length > 0) {
|
||||
cleanup();
|
||||
resolve();
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
const cleanup = () => {
|
||||
clearTimeout(rejectTimeout);
|
||||
clearInterval(bootCheckInterval);
|
||||
};
|
||||
|
||||
cp.on('exit', () => {
|
||||
cleanup();
|
||||
reject('Emulator exited before boot.');
|
||||
});
|
||||
cp.on('error', error => {
|
||||
cleanup();
|
||||
reject(error.message);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
async function tryLaunchEmulator(adbPath) {
|
||||
const emulators = getEmulators();
|
||||
|
||||
if (emulators.length > 0) {
|
||||
try {
|
||||
await launchEmulator(emulators[0], adbPath);
|
||||
return {
|
||||
success: true
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
success: false,
|
||||
error
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: false,
|
||||
error: 'No emulators found as an output of `emulator -list-avds`'
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=tryLaunchEmulator.js.map
|
64
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryRunAdbReverse.js
generated
vendored
Normal file
64
node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/tryRunAdbReverse.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _child_process() {
|
||||
const data = require("child_process");
|
||||
|
||||
_child_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _getAdbPath = _interopRequireDefault(require("./getAdbPath"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
// Runs ADB reverse tcp:8081 tcp:8081 to allow loading the jsbundle from the packager
|
||||
function tryRunAdbReverse(packagerPort, device) {
|
||||
try {
|
||||
const adbPath = (0, _getAdbPath.default)();
|
||||
const adbArgs = ['reverse', `tcp:${packagerPort}`, `tcp:${packagerPort}`]; // If a device is specified then tell adb to use it
|
||||
|
||||
if (device) {
|
||||
adbArgs.unshift('-s', device);
|
||||
}
|
||||
|
||||
_cliTools().logger.info('Connecting to the development server...');
|
||||
|
||||
_cliTools().logger.debug(`Running command "${adbPath} ${adbArgs.join(' ')}"`);
|
||||
|
||||
(0, _child_process().execFileSync)(adbPath, adbArgs, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
} catch (e) {
|
||||
_cliTools().logger.warn(`Failed to connect to development server using "adb reverse": ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = tryRunAdbReverse;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=tryRunAdbReverse.js.map
|
45
node_modules/@react-native-community/cli-platform-android/build/config/findAndroidDir.js
generated
vendored
Normal file
45
node_modules/@react-native-community/cli-platform-android/build/config/findAndroidDir.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = findAndroidDir;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function findAndroidDir(root) {
|
||||
if (_fs().default.existsSync(_path().default.join(root, 'android'))) {
|
||||
return 'android';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=findAndroidDir.js.map
|
46
node_modules/@react-native-community/cli-platform-android/build/config/findManifest.js
generated
vendored
Normal file
46
node_modules/@react-native-community/cli-platform-android/build/config/findManifest.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = findManifest;
|
||||
|
||||
function _glob() {
|
||||
const data = _interopRequireDefault(require("glob"));
|
||||
|
||||
_glob = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function findManifest(folder) {
|
||||
const manifestPath = _glob().default.sync(_path().default.join('**', 'AndroidManifest.xml'), {
|
||||
cwd: folder,
|
||||
ignore: ['node_modules/**', '**/build/**', '**/debug/**', 'Examples/**', 'examples/**']
|
||||
})[0];
|
||||
|
||||
return manifestPath ? _path().default.join(folder, manifestPath) : null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=findManifest.js.map
|
62
node_modules/@react-native-community/cli-platform-android/build/config/findPackageClassName.js
generated
vendored
Normal file
62
node_modules/@react-native-community/cli-platform-android/build/config/findPackageClassName.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getPackageClassName;
|
||||
exports.matchClassName = matchClassName;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _glob() {
|
||||
const data = _interopRequireDefault(require("glob"));
|
||||
|
||||
_glob = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function getPackageClassName(folder) {
|
||||
const files = _glob().default.sync('**/+(*.java|*.kt)', {
|
||||
cwd: folder
|
||||
});
|
||||
|
||||
const packages = files.map(filePath => _fs().default.readFileSync(_path().default.join(folder, filePath), 'utf8')).map(matchClassName).filter(match => match); // @ts-ignore
|
||||
|
||||
return packages.length ? packages[0][1] : null;
|
||||
}
|
||||
|
||||
function matchClassName(file) {
|
||||
return file.match(/class\s+(\w+[^(\s]*)[\s\w():]*(\s+implements\s+|:)[\s\w():,]*[^{]*ReactPackage/);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=findPackageClassName.js.map
|
158
node_modules/@react-native-community/cli-platform-android/build/config/index.js
generated
vendored
Normal file
158
node_modules/@react-native-community/cli-platform-android/build/config/index.js
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.projectConfig = projectConfig;
|
||||
exports.dependencyConfig = dependencyConfig;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _findAndroidDir = _interopRequireDefault(require("./findAndroidDir"));
|
||||
|
||||
var _findManifest = _interopRequireDefault(require("./findManifest"));
|
||||
|
||||
var _findPackageClassName = _interopRequireDefault(require("./findPackageClassName"));
|
||||
|
||||
var _readManifest = _interopRequireDefault(require("./readManifest"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
const getPackageName = manifest => manifest.attr.package;
|
||||
/**
|
||||
* Gets android project config by analyzing given folder and taking some
|
||||
* defaults specified by user into consideration
|
||||
*/
|
||||
|
||||
|
||||
function projectConfig(root, userConfig = {}) {
|
||||
const src = userConfig.sourceDir || (0, _findAndroidDir.default)(root);
|
||||
|
||||
if (!src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const sourceDir = _path().default.join(root, src);
|
||||
|
||||
const appName = getAppName(sourceDir, userConfig.appName);
|
||||
const isFlat = sourceDir.indexOf('app') === -1;
|
||||
const manifestPath = userConfig.manifestPath ? _path().default.join(sourceDir, userConfig.manifestPath) : (0, _findManifest.default)(_path().default.join(sourceDir, appName));
|
||||
|
||||
if (!manifestPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const manifest = (0, _readManifest.default)(manifestPath);
|
||||
const packageName = userConfig.packageName || getPackageName(manifest);
|
||||
|
||||
if (!packageName) {
|
||||
throw new Error(`Package name not found in ${manifestPath}`);
|
||||
}
|
||||
|
||||
const packageFolder = userConfig.packageFolder || packageName.replace(/\./g, _path().default.sep);
|
||||
|
||||
const mainFilePath = _path().default.join(sourceDir, userConfig.mainFilePath || _path().default.join(appName, `src/main/java/${packageFolder}/MainApplication.java`));
|
||||
|
||||
const stringsPath = _path().default.join(sourceDir, userConfig.stringsPath || _path().default.join(appName, '/src/main/res/values/strings.xml'));
|
||||
|
||||
const settingsGradlePath = _path().default.join(sourceDir, userConfig.settingsGradlePath || 'settings.gradle');
|
||||
|
||||
const assetsPath = _path().default.join(sourceDir, userConfig.assetsPath || _path().default.join(appName, '/src/main/assets'));
|
||||
|
||||
const buildGradlePath = _path().default.join(sourceDir, userConfig.buildGradlePath || 'build.gradle');
|
||||
|
||||
return {
|
||||
sourceDir,
|
||||
isFlat,
|
||||
folder: root,
|
||||
stringsPath,
|
||||
manifestPath,
|
||||
buildGradlePath,
|
||||
settingsGradlePath,
|
||||
assetsPath,
|
||||
mainFilePath,
|
||||
packageName,
|
||||
packageFolder,
|
||||
appName
|
||||
};
|
||||
}
|
||||
|
||||
function getAppName(sourceDir, userConfigAppName) {
|
||||
let appName = '';
|
||||
|
||||
if (typeof userConfigAppName === 'string' && _fs().default.existsSync(_path().default.join(sourceDir, userConfigAppName))) {
|
||||
appName = userConfigAppName;
|
||||
} else if (_fs().default.existsSync(_path().default.join(sourceDir, 'app'))) {
|
||||
appName = 'app';
|
||||
}
|
||||
|
||||
return appName;
|
||||
}
|
||||
/**
|
||||
* Same as projectConfigAndroid except it returns
|
||||
* different config that applies to packages only
|
||||
*/
|
||||
|
||||
|
||||
function dependencyConfig(root, userConfig = {}) {
|
||||
const src = userConfig.sourceDir || (0, _findAndroidDir.default)(root);
|
||||
|
||||
if (!src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const sourceDir = _path().default.join(root, src);
|
||||
|
||||
const manifestPath = userConfig.manifestPath ? _path().default.join(sourceDir, userConfig.manifestPath) : (0, _findManifest.default)(sourceDir);
|
||||
|
||||
if (!manifestPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const manifest = (0, _readManifest.default)(manifestPath);
|
||||
const packageName = userConfig.packageName || getPackageName(manifest);
|
||||
const packageClassName = (0, _findPackageClassName.default)(sourceDir);
|
||||
/**
|
||||
* This module has no package to export
|
||||
*/
|
||||
|
||||
if (!packageClassName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const packageImportPath = userConfig.packageImportPath || `import ${packageName}.${packageClassName};`;
|
||||
const packageInstance = userConfig.packageInstance || `new ${packageClassName}()`;
|
||||
return {
|
||||
sourceDir,
|
||||
folder: root,
|
||||
packageImportPath,
|
||||
packageInstance
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
41
node_modules/@react-native-community/cli-platform-android/build/config/readManifest.js
generated
vendored
Normal file
41
node_modules/@react-native-community/cli-platform-android/build/config/readManifest.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = readManifest;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _xmldoc() {
|
||||
const data = _interopRequireDefault(require("xmldoc"));
|
||||
|
||||
_xmldoc = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function readManifest(manifestPath) {
|
||||
return new (_xmldoc().default.XmlDocument)(_fs().default.readFileSync(manifestPath, 'utf8'));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=readManifest.js.map
|
53
node_modules/@react-native-community/cli-platform-android/build/index.js
generated
vendored
Normal file
53
node_modules/@react-native-community/cli-platform-android/build/index.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "linkConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _link.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "commands", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _commands.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "projectConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.projectConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "dependencyConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.dependencyConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getAndroidProject", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _getAndroidProject.getAndroidProject;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getPackageName", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _getAndroidProject.getPackageName;
|
||||
}
|
||||
});
|
||||
|
||||
var _link = _interopRequireDefault(require("./link"));
|
||||
|
||||
var _commands = _interopRequireDefault(require("./commands"));
|
||||
|
||||
var _config = require("./config");
|
||||
|
||||
var _getAndroidProject = require("./utils/getAndroidProject");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
70
node_modules/@react-native-community/cli-platform-android/build/link/copyAssets.js
generated
vendored
Normal file
70
node_modules/@react-native-community/cli-platform-android/build/link/copyAssets.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = copyAssetsAndroid;
|
||||
|
||||
function _fsExtra() {
|
||||
const data = _interopRequireDefault(require("fs-extra"));
|
||||
|
||||
_fsExtra = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copies each file from an array of assets provided to targetPath directory
|
||||
*
|
||||
* For now, the only types of files that are handled are:
|
||||
* - Fonts (otf, ttf) - copied to targetPath/fonts under original name
|
||||
*/
|
||||
function copyAssetsAndroid(files, project) {
|
||||
const assets = (0, _cliTools().groupFilesByType)(files);
|
||||
|
||||
_cliTools().logger.debug(`Assets path: ${project.assetsPath}`);
|
||||
|
||||
(assets.font || []).forEach(asset => {
|
||||
const fontsDir = _path().default.join(project.assetsPath, 'fonts');
|
||||
|
||||
_cliTools().logger.debug(`Copying asset ${asset}`); // @todo: replace with fs.mkdirSync(path, {recursive}) + fs.copyFileSync
|
||||
// and get rid of fs-extra once we move to Node 10
|
||||
|
||||
|
||||
_fsExtra().default.copySync(asset, _path().default.join(fontsDir, _path().default.basename(asset)));
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=copyAssets.js.map
|
41
node_modules/@react-native-community/cli-platform-android/build/link/index.js
generated
vendored
Normal file
41
node_modules/@react-native-community/cli-platform-android/build/link/index.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getAndroidLinkConfig = getAndroidLinkConfig;
|
||||
exports.default = void 0;
|
||||
|
||||
var _isInstalled = _interopRequireDefault(require("./isInstalled"));
|
||||
|
||||
var _registerNativeModule = _interopRequireDefault(require("./registerNativeModule"));
|
||||
|
||||
var _unregisterNativeModule = _interopRequireDefault(require("./unregisterNativeModule"));
|
||||
|
||||
var _copyAssets = _interopRequireDefault(require("./copyAssets"));
|
||||
|
||||
var _unlinkAssets = _interopRequireDefault(require("./unlinkAssets"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function getAndroidLinkConfig() {
|
||||
return {
|
||||
isInstalled: _isInstalled.default,
|
||||
register: _registerNativeModule.default,
|
||||
unregister: _unregisterNativeModule.default,
|
||||
copyAssets: _copyAssets.default,
|
||||
unlinkAssets: _unlinkAssets.default
|
||||
};
|
||||
}
|
||||
|
||||
var _default = getAndroidLinkConfig;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
35
node_modules/@react-native-community/cli-platform-android/build/link/isInstalled.js
generated
vendored
Normal file
35
node_modules/@react-native-community/cli-platform-android/build/link/isInstalled.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isInstalled;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _makeBuildPatch = _interopRequireDefault(require("./patches/makeBuildPatch"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function isInstalled(config, name) {
|
||||
const buildGradle = _fs().default.readFileSync(config.buildGradlePath, 'utf8');
|
||||
|
||||
return (0, _makeBuildPatch.default)(name).installPattern.test(buildGradle);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=isInstalled.js.map
|
33
node_modules/@react-native-community/cli-platform-android/build/link/patches/applyParams.js
generated
vendored
Normal file
33
node_modules/@react-native-community/cli-platform-android/build/link/patches/applyParams.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = applyParams;
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function applyParams(str, params, prefix) {
|
||||
return str.replace(/\$\{(\w+)\}/g, (_pattern, param) => {
|
||||
const name = `${(0, _lodash().camelCase)(prefix)}_${param}`; // @ts-ignore
|
||||
|
||||
return params[param] ? `getResources().getString(R.string.${name})` : 'null';
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=applyParams.js.map
|
45
node_modules/@react-native-community/cli-platform-android/build/link/patches/applyPatch.js
generated
vendored
Normal file
45
node_modules/@react-native-community/cli-platform-android/build/link/patches/applyPatch.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = applyPatch;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function applyPatch(file, patch) {
|
||||
if (file) {
|
||||
_cliTools().logger.debug(`Patching ${file}`);
|
||||
}
|
||||
|
||||
_fs().default.writeFileSync(file, _fs().default.readFileSync(file, 'utf8').replace(patch.pattern, match => `${match}${patch.patch}`));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=applyPatch.js.map
|
66
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeBuildPatch.js
generated
vendored
Normal file
66
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeBuildPatch.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeBuildPatch;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _normalizeProjectName = _interopRequireDefault(require("./normalizeProjectName"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
const depConfigs = ['compile', 'api', 'implementation'];
|
||||
|
||||
function makeBuildPatch(name, buildGradlePath) {
|
||||
const normalizedProjectName = (0, _normalizeProjectName.default)(name);
|
||||
const installPattern = new RegExp(buildDepRegExp(normalizedProjectName, ...depConfigs));
|
||||
return {
|
||||
installPattern,
|
||||
pattern: /[^ \t]dependencies {(\r\n|\n)/,
|
||||
patch: makePatchString(normalizedProjectName, buildGradlePath)
|
||||
};
|
||||
}
|
||||
|
||||
function makePatchString(normalizedProjectName, buildGradlePath) {
|
||||
const defaultPatchString = ` implementation project(':${normalizedProjectName}')\n`;
|
||||
|
||||
if (!buildGradlePath) {
|
||||
return defaultPatchString;
|
||||
}
|
||||
|
||||
const buildGradle = _fs().default.readFileSync(buildGradlePath, 'utf8');
|
||||
|
||||
for (const config of depConfigs) {
|
||||
const depPattern = new RegExp(buildDepRegExp(normalizedProjectName, config));
|
||||
|
||||
if (depPattern.test(buildGradle)) {
|
||||
return ` ${config} project(':${normalizedProjectName}')\n`;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultPatchString;
|
||||
}
|
||||
|
||||
function buildDepRegExp(normalizedProjectName, ...configs) {
|
||||
const orConfigs = configs.join('|');
|
||||
return `(${orConfigs})\\w*\\s*\\(*project\\s*\\(['"]:${normalizedProjectName}['"]\\)`;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=makeBuildPatch.js.map
|
22
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeImportPatch.js
generated
vendored
Normal file
22
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeImportPatch.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeImportPatch;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function makeImportPatch(packageImportPath) {
|
||||
return {
|
||||
pattern: 'import com.facebook.react.ReactApplication;',
|
||||
patch: `\n${packageImportPath}`
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=makeImportPatch.js.map
|
27
node_modules/@react-native-community/cli-platform-android/build/link/patches/makePackagePatch.js
generated
vendored
Normal file
27
node_modules/@react-native-community/cli-platform-android/build/link/patches/makePackagePatch.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makePackagePatch;
|
||||
|
||||
var _applyParams = _interopRequireDefault(require("./applyParams"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function makePackagePatch(packageInstance, params, prefix) {
|
||||
const processedInstance = (0, _applyParams.default)(packageInstance, params, prefix);
|
||||
return {
|
||||
pattern: 'new MainReactPackage()',
|
||||
patch: `,\n ${processedInstance}`
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=makePackagePatch.js.map
|
49
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeSettingsPatch.js
generated
vendored
Normal file
49
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeSettingsPatch.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeSettingsPatch;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require("slash"));
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _normalizeProjectName = _interopRequireDefault(require("./normalizeProjectName"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function makeSettingsPatch(name, androidConfig, projectConfig) {
|
||||
// Gradle expects paths to be posix even on Windows
|
||||
const projectDir = (0, _slash().default)(_path().default.relative(_path().default.dirname(projectConfig.settingsGradlePath), androidConfig.sourceDir));
|
||||
const normalizedProjectName = (0, _normalizeProjectName.default)(name);
|
||||
return {
|
||||
pattern: '\n',
|
||||
patch: `include ':${normalizedProjectName}'\n` + `project(':${normalizedProjectName}').projectDir = ` + `new File(rootProject.projectDir, '${projectDir}')\n`
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=makeSettingsPatch.js.map
|
38
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeStringsPatch.js
generated
vendored
Normal file
38
node_modules/@react-native-community/cli-platform-android/build/link/patches/makeStringsPatch.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeStringsPatch;
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function makeStringsPatch(params, prefix) {
|
||||
const values = Object.keys(params).map(param => {
|
||||
const name = `${(0, _lodash().camelCase)(prefix)}_${param}`;
|
||||
return ' ' + // @ts-ignore
|
||||
`<string moduleConfig="true" name="${name}">${params[param]}</string>`;
|
||||
});
|
||||
const patch = values.length > 0 ? `${values.join('\n')}\n` : '';
|
||||
return {
|
||||
pattern: '<resources>\n',
|
||||
patch
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=makeStringsPatch.js.map
|
19
node_modules/@react-native-community/cli-platform-android/build/link/patches/normalizeProjectName.js
generated
vendored
Normal file
19
node_modules/@react-native-community/cli-platform-android/build/link/patches/normalizeProjectName.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = normalizeProjectName;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function normalizeProjectName(name) {
|
||||
return name.replace(/\//g, '_');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=normalizeProjectName.js.map
|
45
node_modules/@react-native-community/cli-platform-android/build/link/patches/revokePatch.js
generated
vendored
Normal file
45
node_modules/@react-native-community/cli-platform-android/build/link/patches/revokePatch.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = revokePatch;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function revokePatch(file, patch) {
|
||||
if (file) {
|
||||
_cliTools().logger.debug(`Patching ${file}`);
|
||||
}
|
||||
|
||||
_fs().default.writeFileSync(file, _fs().default.readFileSync(file, 'utf8').replace(patch.patch, ''));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=revokePatch.js.map
|
38
node_modules/@react-native-community/cli-platform-android/build/link/registerNativeModule.js
generated
vendored
Normal file
38
node_modules/@react-native-community/cli-platform-android/build/link/registerNativeModule.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = registerNativeAndroidModule;
|
||||
|
||||
var _applyPatch = _interopRequireDefault(require("./patches/applyPatch"));
|
||||
|
||||
var _makeStringsPatch = _interopRequireDefault(require("./patches/makeStringsPatch"));
|
||||
|
||||
var _makeSettingsPatch = _interopRequireDefault(require("./patches/makeSettingsPatch"));
|
||||
|
||||
var _makeBuildPatch = _interopRequireDefault(require("./patches/makeBuildPatch"));
|
||||
|
||||
var _makeImportPatch = _interopRequireDefault(require("./patches/makeImportPatch"));
|
||||
|
||||
var _makePackagePatch = _interopRequireDefault(require("./patches/makePackagePatch"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function registerNativeAndroidModule(name, androidConfig, params, projectConfig) {
|
||||
const buildPatch = (0, _makeBuildPatch.default)(name);
|
||||
(0, _applyPatch.default)(projectConfig.settingsGradlePath, (0, _makeSettingsPatch.default)(name, androidConfig, projectConfig));
|
||||
(0, _applyPatch.default)(projectConfig.buildGradlePath, buildPatch);
|
||||
(0, _applyPatch.default)(projectConfig.stringsPath, (0, _makeStringsPatch.default)(params, name));
|
||||
(0, _applyPatch.default)(projectConfig.mainFilePath, (0, _makePackagePatch.default)(androidConfig.packageInstance, params, name));
|
||||
(0, _applyPatch.default)(projectConfig.mainFilePath, (0, _makeImportPatch.default)(androidConfig.packageImportPath));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=registerNativeModule.js.map
|
70
node_modules/@react-native-community/cli-platform-android/build/link/unlinkAssets.js
generated
vendored
Normal file
70
node_modules/@react-native-community/cli-platform-android/build/link/unlinkAssets.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = unlinkAssetsAndroid;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copies each file from an array of assets provided to targetPath directory
|
||||
*
|
||||
* For now, the only types of files that are handled are:
|
||||
* - Fonts (otf, ttf) - copied to targetPath/fonts under original name
|
||||
*/
|
||||
function unlinkAssetsAndroid(files, project) {
|
||||
const assets = (0, _cliTools().groupFilesByType)(files);
|
||||
|
||||
_cliTools().logger.debug(`Assets path: ${project.assetsPath}`);
|
||||
|
||||
(assets.font || []).forEach(file => {
|
||||
const filePath = _path().default.join(project.assetsPath, 'fonts', _path().default.basename(file));
|
||||
|
||||
if (_fs().default.existsSync(filePath)) {
|
||||
_cliTools().logger.debug(`Removing asset ${filePath}`);
|
||||
|
||||
_fs().default.unlinkSync(filePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=unlinkAssets.js.map
|
67
node_modules/@react-native-community/cli-platform-android/build/link/unregisterNativeModule.js
generated
vendored
Normal file
67
node_modules/@react-native-community/cli-platform-android/build/link/unregisterNativeModule.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = unregisterNativeAndroidModule;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _revokePatch = _interopRequireDefault(require("./patches/revokePatch"));
|
||||
|
||||
var _makeSettingsPatch = _interopRequireDefault(require("./patches/makeSettingsPatch"));
|
||||
|
||||
var _makeBuildPatch = _interopRequireDefault(require("./patches/makeBuildPatch"));
|
||||
|
||||
var _makeStringsPatch = _interopRequireDefault(require("./patches/makeStringsPatch"));
|
||||
|
||||
var _makeImportPatch = _interopRequireDefault(require("./patches/makeImportPatch"));
|
||||
|
||||
var _makePackagePatch = _interopRequireDefault(require("./patches/makePackagePatch"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
function unregisterNativeAndroidModule(name, androidConfig, projectConfig) {
|
||||
const buildPatch = (0, _makeBuildPatch.default)(name, projectConfig.buildGradlePath);
|
||||
|
||||
const strings = _fs().default.readFileSync(projectConfig.stringsPath, 'utf8');
|
||||
|
||||
const params = {};
|
||||
strings.replace(/moduleConfig="true" name="(\w+)">(.*)</g, // @ts-ignore
|
||||
(_, param, value) => {
|
||||
// @ts-ignore
|
||||
params[param.slice((0, _lodash().camelCase)(name).length + 1)] = value;
|
||||
});
|
||||
(0, _revokePatch.default)(projectConfig.settingsGradlePath, (0, _makeSettingsPatch.default)(name, androidConfig, projectConfig));
|
||||
(0, _revokePatch.default)(projectConfig.buildGradlePath, buildPatch);
|
||||
(0, _revokePatch.default)(projectConfig.stringsPath, (0, _makeStringsPatch.default)(params, name));
|
||||
(0, _revokePatch.default)(projectConfig.mainFilePath, (0, _makePackagePatch.default)(androidConfig.packageInstance, params, name));
|
||||
(0, _revokePatch.default)(projectConfig.mainFilePath, (0, _makeImportPatch.default)(androidConfig.packageImportPath));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=unregisterNativeModule.js.map
|
60
node_modules/@react-native-community/cli-platform-android/build/link/warnAboutManuallyLinkedLibs.js
generated
vendored
Normal file
60
node_modules/@react-native-community/cli-platform-android/build/link/warnAboutManuallyLinkedLibs.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = warnAboutManuallyLinkedLibs;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _index = _interopRequireDefault(require("./index"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// TODO: move to cli-tools once platform-ios and platform-android are migrated
|
||||
// to TS and unify with iOS implementation
|
||||
function warnAboutManuallyLinkedLibs(config, platform = 'android', linkConfig = (0, _index.default)()) {
|
||||
let deps = [];
|
||||
|
||||
for (let key in config.dependencies) {
|
||||
const dependency = config.dependencies[key];
|
||||
|
||||
try {
|
||||
const projectConfig = config.project[platform];
|
||||
const dependencyConfig = dependency.platforms[platform];
|
||||
|
||||
if (projectConfig && dependencyConfig) {
|
||||
const x = linkConfig.isInstalled(projectConfig, dependency.name, dependencyConfig);
|
||||
deps = deps.concat(x ? dependency.name : []);
|
||||
}
|
||||
} catch (error) {
|
||||
_cliTools().logger.debug('Checking manually linked modules failed.', error);
|
||||
}
|
||||
}
|
||||
|
||||
const installedModules = [...new Set(deps)];
|
||||
|
||||
if (installedModules.length) {
|
||||
_cliTools().logger.error(`React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: \n${installedModules.map(x => ` - ${_chalk().default.bold(x)} ${_chalk().default.dim(`(to unlink run: "react-native unlink ${x}")`)}`).join('\n')}\nThis is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.\nRead more about autolinking: ${_chalk().default.dim.underline('https://github.com/react-native-community/cli/blob/master/docs/autolinking.md')}`);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=warnAboutManuallyLinkedLibs.js.map
|
88
node_modules/@react-native-community/cli-platform-android/build/utils/getAndroidProject.js
generated
vendored
Normal file
88
node_modules/@react-native-community/cli-platform-android/build/utils/getAndroidProject.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getAndroidProject = getAndroidProject;
|
||||
exports.getPackageName = getPackageName;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getAndroidProject(config) {
|
||||
const androidProject = config.project.android;
|
||||
|
||||
if (!androidProject) {
|
||||
throw new (_cliTools().CLIError)(`
|
||||
Android project not found. Are you sure this is a React Native project?
|
||||
If your Android files are located in a non-standard location (e.g. not inside \'android\' folder), consider setting
|
||||
\`project.android.sourceDir\` option to point to a new location.
|
||||
`);
|
||||
}
|
||||
|
||||
return androidProject;
|
||||
}
|
||||
/**
|
||||
* Get the package name of the running React Native app
|
||||
* @param config
|
||||
*/
|
||||
|
||||
|
||||
function getPackageName(androidProject, appFolder) {
|
||||
const {
|
||||
appName,
|
||||
manifestPath
|
||||
} = androidProject;
|
||||
|
||||
const androidManifest = _fs().default.readFileSync(manifestPath, 'utf8');
|
||||
|
||||
let packageNameMatchArray = androidManifest.match(/package="(.+?)"/);
|
||||
|
||||
if (!packageNameMatchArray || packageNameMatchArray.length === 0) {
|
||||
throw new (_cliTools().CLIError)(`Failed to build the app: No package name found. Found errors in ${_chalk().default.underline.dim(`${appFolder || appName}/src/main/AndroidManifest.xml`)}`);
|
||||
}
|
||||
|
||||
let packageName = packageNameMatchArray[1];
|
||||
|
||||
if (!validatePackageName(packageName)) {
|
||||
_cliTools().logger.warn(`Invalid application's package name "${_chalk().default.bgRed(packageName)}" in 'AndroidManifest.xml'. Read guidelines for setting the package name here: ${_chalk().default.underline.dim('https://developer.android.com/studio/build/application-id')}`);
|
||||
}
|
||||
|
||||
return packageName;
|
||||
} // Validates that the package name is correct
|
||||
|
||||
|
||||
function validatePackageName(packageName) {
|
||||
return /^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/.test(packageName);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getAndroidProject.js.map
|
Reference in New Issue
Block a user