yeet
This commit is contained in:
21
node_modules/@react-native-community/cli/LICENSE
generated
vendored
Normal file
21
node_modules/@react-native-community/cli/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 react-native-community
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
7
node_modules/@react-native-community/cli/README.md
generated
vendored
Normal file
7
node_modules/@react-native-community/cli/README.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
# React Native CLI
|
||||
|
||||
Command line tools to interact with React Native projects.
|
||||
|
||||
This package contains source code for `@react-native-community/cli`, the actual CLI that comes bundled with React Native. You don't need to install it separately in your project.
|
||||
|
||||
See the [list of available commands](../../docs/commands.md).
|
10
node_modules/@react-native-community/cli/build/bin.js
generated
vendored
Executable file
10
node_modules/@react-native-community/cli/build/bin.js
generated
vendored
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
require("./tools/gracefulifyFs");
|
||||
|
||||
var _ = require("./");
|
||||
|
||||
(0, _.run)();
|
||||
|
||||
//# sourceMappingURL=bin.js.map
|
88
node_modules/@react-native-community/cli/build/commands/bundle/assetPathUtils.js
generated
vendored
Normal file
88
node_modules/@react-native-community/cli/build/commands/bundle/assetPathUtils.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
"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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* FIXME: using number to represent discrete scale numbers is fragile in essence because of
|
||||
* floating point numbers imprecision.
|
||||
*/
|
||||
function getAndroidAssetSuffix(scale) {
|
||||
switch (scale) {
|
||||
case 0.75:
|
||||
return 'ldpi';
|
||||
|
||||
case 1:
|
||||
return 'mdpi';
|
||||
|
||||
case 1.5:
|
||||
return 'hdpi';
|
||||
|
||||
case 2:
|
||||
return 'xhdpi';
|
||||
|
||||
case 3:
|
||||
return 'xxhdpi';
|
||||
|
||||
case 4:
|
||||
return 'xxxhdpi';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
} // See https://developer.android.com/guide/topics/resources/drawable-resource.html
|
||||
|
||||
|
||||
const drawableFileTypes = new Set(['gif', 'jpeg', 'jpg', 'png', 'webp', 'xml']);
|
||||
|
||||
function getAndroidResourceFolderName(asset, scale) {
|
||||
if (!drawableFileTypes.has(asset.type)) {
|
||||
return 'raw';
|
||||
}
|
||||
|
||||
const suffix = getAndroidAssetSuffix(scale);
|
||||
|
||||
if (!suffix) {
|
||||
throw new Error(`Don't know which android drawable suffix to use for asset: ${JSON.stringify(asset)}`);
|
||||
}
|
||||
|
||||
const androidFolder = `drawable-${suffix}`;
|
||||
return androidFolder;
|
||||
}
|
||||
|
||||
function getAndroidResourceIdentifier(asset) {
|
||||
const folderPath = getBasePath(asset);
|
||||
return `${folderPath}/${asset.name}`.toLowerCase().replace(/\//g, '_') // Encode folder structure in file name
|
||||
.replace(/([^a-z0-9_])/g, '') // Remove illegal chars
|
||||
.replace(/^assets_/, ''); // Remove "assets_" prefix
|
||||
}
|
||||
|
||||
function getBasePath(asset) {
|
||||
let basePath = asset.httpServerLocation;
|
||||
|
||||
if (basePath[0] === '/') {
|
||||
basePath = basePath.substr(1);
|
||||
}
|
||||
|
||||
return basePath;
|
||||
}
|
||||
|
||||
var _default = {
|
||||
getAndroidAssetSuffix,
|
||||
getAndroidResourceFolderName,
|
||||
getAndroidResourceIdentifier,
|
||||
getBasePath
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=assetPathUtils.js.map
|
124
node_modules/@react-native-community/cli/build/commands/bundle/buildBundle.js
generated
vendored
Normal file
124
node_modules/@react-native-community/cli/build/commands/bundle/buildBundle.js
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _Server() {
|
||||
const data = _interopRequireDefault(require("metro/src/Server"));
|
||||
|
||||
_Server = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _bundle() {
|
||||
const data = _interopRequireDefault(require("metro/src/shared/output/bundle"));
|
||||
|
||||
_bundle = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _saveAssets = _interopRequireDefault(require("./saveAssets"));
|
||||
|
||||
var _loadMetroConfig = _interopRequireDefault(require("../../tools/loadMetroConfig"));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
// @ts-ignore - no typed definition for the package
|
||||
// @ts-ignore - no typed definition for the package
|
||||
async function buildBundle(args, ctx, output = _bundle().default) {
|
||||
const config = await (0, _loadMetroConfig.default)(ctx, {
|
||||
maxWorkers: args.maxWorkers,
|
||||
resetCache: args.resetCache,
|
||||
config: args.config
|
||||
});
|
||||
|
||||
if (config.resolver.platforms.indexOf(args.platform) === -1) {
|
||||
_cliTools().logger.error(`Invalid platform ${args.platform ? `"${_chalk().default.bold(args.platform)}" ` : ''}selected.`);
|
||||
|
||||
_cliTools().logger.info(`Available platforms are: ${config.resolver.platforms.map(x => `"${_chalk().default.bold(x)}"`).join(', ')}. If you are trying to bundle for an out-of-tree platform, it may not be installed.`);
|
||||
|
||||
throw new Error('Bundling failed');
|
||||
} // This is used by a bazillion of npm modules we don't control so we don't
|
||||
// have other choice than defining it as an env variable here.
|
||||
|
||||
|
||||
process.env.NODE_ENV = args.dev ? 'development' : 'production';
|
||||
let sourceMapUrl = args.sourcemapOutput;
|
||||
|
||||
if (sourceMapUrl && !args.sourcemapUseAbsolutePath) {
|
||||
sourceMapUrl = _path().default.basename(sourceMapUrl);
|
||||
}
|
||||
|
||||
const requestOpts = {
|
||||
entryFile: args.entryFile,
|
||||
sourceMapUrl,
|
||||
dev: args.dev,
|
||||
minify: args.minify !== undefined ? args.minify : !args.dev,
|
||||
platform: args.platform
|
||||
};
|
||||
const server = new (_Server().default)(config);
|
||||
|
||||
try {
|
||||
const bundle = await output.build(server, requestOpts);
|
||||
await output.save(bundle, args, _cliTools().logger.info); // Save the assets of the bundle
|
||||
|
||||
const outputAssets = await server.getAssets({ ..._Server().default.DEFAULT_BUNDLE_OPTIONS,
|
||||
...requestOpts,
|
||||
bundleType: 'todo'
|
||||
}); // When we're done saving bundle output and the assets, we're done.
|
||||
|
||||
return await (0, _saveAssets.default)(outputAssets, args.platform, args.assetsDest);
|
||||
} finally {
|
||||
server.end();
|
||||
}
|
||||
}
|
||||
|
||||
var _default = buildBundle;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=buildBundle.js.map
|
42
node_modules/@react-native-community/cli/build/commands/bundle/bundle.js
generated
vendored
Normal file
42
node_modules/@react-native-community/cli/build/commands/bundle/bundle.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.withOutput = exports.default = void 0;
|
||||
|
||||
var _buildBundle = _interopRequireDefault(require("./buildBundle"));
|
||||
|
||||
var _bundleCommandLineArgs = _interopRequireDefault(require("./bundleCommandLineArgs"));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Builds the bundle starting to look for dependencies at the given entry path.
|
||||
*/
|
||||
function bundleWithOutput(_, config, args, output) // untyped metro/src/shared/output/bundle or metro/src/shared/output/RamBundle
|
||||
{
|
||||
return (0, _buildBundle.default)(args, config, output);
|
||||
}
|
||||
|
||||
var _default = {
|
||||
name: 'bundle',
|
||||
description: 'builds the javascript bundle for offline use',
|
||||
func: bundleWithOutput,
|
||||
options: _bundleCommandLineArgs.default,
|
||||
// Used by `ramBundle.js`
|
||||
withOutput: bundleWithOutput
|
||||
};
|
||||
exports.default = _default;
|
||||
const withOutput = bundleWithOutput;
|
||||
exports.withOutput = withOutput;
|
||||
|
||||
//# sourceMappingURL=bundle.js.map
|
85
node_modules/@react-native-community/cli/build/commands/bundle/bundleCommandLineArgs.js
generated
vendored
Normal file
85
node_modules/@react-native-community/cli/build/commands/bundle/bundleCommandLineArgs.js
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
"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 _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.
|
||||
*
|
||||
*/
|
||||
var _default = [{
|
||||
name: '--entry-file <path>',
|
||||
description: 'Path to the root JS file, either absolute or relative to JS root'
|
||||
}, {
|
||||
name: '--platform [string]',
|
||||
description: 'Either "ios" or "android"',
|
||||
default: 'ios'
|
||||
}, {
|
||||
name: '--transformer [string]',
|
||||
description: 'Specify a custom transformer to be used'
|
||||
}, {
|
||||
name: '--dev [boolean]',
|
||||
description: 'If false, warnings are disabled and the bundle is minified',
|
||||
parse: val => val !== 'false',
|
||||
default: true
|
||||
}, {
|
||||
name: '--minify [boolean]',
|
||||
description: 'Allows overriding whether bundle is minified. This defaults to ' + 'false if dev is true, and true if dev is false. Disabling minification ' + 'can be useful for speeding up production builds for testing purposes.',
|
||||
parse: val => val !== 'false'
|
||||
}, {
|
||||
name: '--bundle-output <string>',
|
||||
description: 'File name where to store the resulting bundle, ex. /tmp/groups.bundle'
|
||||
}, {
|
||||
name: '--bundle-encoding [string]',
|
||||
description: 'Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer).',
|
||||
default: 'utf8'
|
||||
}, {
|
||||
name: '--max-workers [number]',
|
||||
description: 'Specifies the maximum number of workers the worker-pool ' + 'will spawn for transforming files. This defaults to the number of the ' + 'cores available on your machine.',
|
||||
parse: workers => Number(workers)
|
||||
}, {
|
||||
name: '--sourcemap-output [string]',
|
||||
description: 'File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map'
|
||||
}, {
|
||||
name: '--sourcemap-sources-root [string]',
|
||||
description: "Path to make sourcemap's sources entries relative to, ex. /root/dir"
|
||||
}, {
|
||||
name: '--sourcemap-use-absolute-path',
|
||||
description: 'Report SourceMapURL using its full path',
|
||||
default: false
|
||||
}, {
|
||||
name: '--assets-dest [string]',
|
||||
description: 'Directory name where to store assets referenced in the bundle'
|
||||
}, {
|
||||
name: '--reset-cache',
|
||||
description: 'Removes cached files',
|
||||
default: false
|
||||
}, {
|
||||
name: '--read-global-cache',
|
||||
description: 'Try to fetch transformed JS code from the global cache, if configured.',
|
||||
default: false
|
||||
}, {
|
||||
name: '--config [string]',
|
||||
description: 'Path to the CLI configuration file',
|
||||
parse: val => _path().default.resolve(val)
|
||||
}];
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=bundleCommandLineArgs.js.map
|
53
node_modules/@react-native-community/cli/build/commands/bundle/filterPlatformAssetScales.js
generated
vendored
Normal file
53
node_modules/@react-native-community/cli/build/commands/bundle/filterPlatformAssetScales.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"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.
|
||||
*
|
||||
*/
|
||||
const ALLOWED_SCALES = {
|
||||
ios: [1, 2, 3]
|
||||
};
|
||||
|
||||
function filterPlatformAssetScales(platform, scales) {
|
||||
const whitelist = ALLOWED_SCALES[platform];
|
||||
|
||||
if (!whitelist) {
|
||||
return scales;
|
||||
}
|
||||
|
||||
const result = scales.filter(scale => whitelist.indexOf(scale) > -1);
|
||||
|
||||
if (result.length === 0 && scales.length > 0) {
|
||||
// No matching scale found, but there are some available. Ideally we don't
|
||||
// want to be in this situation and should throw, but for now as a fallback
|
||||
// let's just use the closest larger image
|
||||
const maxScale = whitelist[whitelist.length - 1];
|
||||
|
||||
for (const scale of scales) {
|
||||
if (scale > maxScale) {
|
||||
result.push(scale);
|
||||
break;
|
||||
}
|
||||
} // There is no larger scales available, use the largest we have
|
||||
|
||||
|
||||
if (result.length === 0) {
|
||||
result.push(scales[scales.length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var _default = filterPlatformAssetScales;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=filterPlatformAssetScales.js.map
|
40
node_modules/@react-native-community/cli/build/commands/bundle/getAssetDestPathAndroid.js
generated
vendored
Normal file
40
node_modules/@react-native-community/cli/build/commands/bundle/getAssetDestPathAndroid.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
var _assetPathUtils = _interopRequireDefault(require("./assetPathUtils"));
|
||||
|
||||
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 getAssetDestPathAndroid(asset, scale) {
|
||||
const androidFolder = _assetPathUtils.default.getAndroidResourceFolderName(asset, scale);
|
||||
|
||||
const fileName = _assetPathUtils.default.getAndroidResourceIdentifier(asset);
|
||||
|
||||
return _path().default.join(androidFolder, `${fileName}.${asset.type}`);
|
||||
}
|
||||
|
||||
var _default = getAssetDestPathAndroid;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=getAssetDestPathAndroid.js.map
|
39
node_modules/@react-native-community/cli/build/commands/bundle/getAssetDestPathIOS.js
generated
vendored
Normal file
39
node_modules/@react-native-community/cli/build/commands/bundle/getAssetDestPathIOS.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"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 _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 getAssetDestPathIOS(asset, scale) {
|
||||
const suffix = scale === 1 ? '' : `@${scale}x`;
|
||||
const fileName = `${asset.name + suffix}.${asset.type}`;
|
||||
return _path().default.join( // Assets can have relative paths outside of the project root.
|
||||
// Replace `../` with `_` to make sure they don't end up outside of
|
||||
// the expected assets directory.
|
||||
asset.httpServerLocation.substr(1).replace(/\.\.\//g, '_'), fileName);
|
||||
}
|
||||
|
||||
var _default = getAssetDestPathIOS;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=getAssetDestPathIOS.js.map
|
52
node_modules/@react-native-community/cli/build/commands/bundle/ramBundle.js
generated
vendored
Normal file
52
node_modules/@react-native-community/cli/build/commands/bundle/ramBundle.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _RamBundle() {
|
||||
const data = _interopRequireDefault(require("metro/src/shared/output/RamBundle"));
|
||||
|
||||
_RamBundle = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _bundle = require("./bundle");
|
||||
|
||||
var _bundleCommandLineArgs = _interopRequireDefault(require("./bundleCommandLineArgs"));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
// @ts-ignore - no typed definition for the package
|
||||
|
||||
/**
|
||||
* Builds the bundle starting to look for dependencies at the given entry path.
|
||||
*/
|
||||
function ramBundle(argv, config, args) {
|
||||
return (0, _bundle.withOutput)(argv, config, args, _RamBundle().default);
|
||||
}
|
||||
|
||||
var _default = {
|
||||
name: 'ram-bundle',
|
||||
description: 'builds javascript as a "Random Access Module" bundle for offline use',
|
||||
func: ramBundle,
|
||||
options: _bundleCommandLineArgs.default.concat({
|
||||
name: '--indexed-ram-bundle',
|
||||
description: 'Force the "Indexed RAM" bundle file format, even when building for android',
|
||||
default: false
|
||||
})
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=ramBundle.js.map
|
138
node_modules/@react-native-community/cli/build/commands/bundle/saveAssets.js
generated
vendored
Normal file
138
node_modules/@react-native-community/cli/build/commands/bundle/saveAssets.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _mkdirp() {
|
||||
const data = _interopRequireDefault(require("mkdirp"));
|
||||
|
||||
_mkdirp = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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 _filterPlatformAssetScales = _interopRequireDefault(require("./filterPlatformAssetScales"));
|
||||
|
||||
var _getAssetDestPathAndroid = _interopRequireDefault(require("./getAssetDestPathAndroid"));
|
||||
|
||||
var _getAssetDestPathIOS = _interopRequireDefault(require("./getAssetDestPathIOS"));
|
||||
|
||||
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 saveAssets(assets, platform, assetsDest) {
|
||||
if (!assetsDest) {
|
||||
_cliTools().logger.warn('Assets destination folder is not set, skipping...');
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const getAssetDestPath = platform === 'android' ? _getAssetDestPathAndroid.default : _getAssetDestPathIOS.default;
|
||||
const filesToCopy = Object.create(null); // Map src -> dest
|
||||
|
||||
assets.forEach(asset => {
|
||||
const validScales = new Set((0, _filterPlatformAssetScales.default)(platform, asset.scales));
|
||||
asset.scales.forEach((scale, idx) => {
|
||||
if (!validScales.has(scale)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const src = asset.files[idx];
|
||||
|
||||
const dest = _path().default.join(assetsDest, getAssetDestPath(asset, scale));
|
||||
|
||||
filesToCopy[src] = dest;
|
||||
});
|
||||
});
|
||||
return copyAll(filesToCopy);
|
||||
}
|
||||
|
||||
function copyAll(filesToCopy) {
|
||||
const queue = Object.keys(filesToCopy);
|
||||
|
||||
if (queue.length === 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`Copying ${queue.length} asset files`);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const copyNext = error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (queue.length === 0) {
|
||||
_cliTools().logger.info('Done copying assets');
|
||||
|
||||
resolve();
|
||||
} else {
|
||||
// queue.length === 0 is checked in previous branch, so this is string
|
||||
const src = queue.shift();
|
||||
const dest = filesToCopy[src];
|
||||
copy(src, dest, copyNext);
|
||||
}
|
||||
};
|
||||
|
||||
copyNext();
|
||||
});
|
||||
}
|
||||
|
||||
function copy(src, dest, callback) {
|
||||
const destDir = _path().default.dirname(dest);
|
||||
|
||||
(0, _mkdirp().default)(destDir, err => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
_fs().default.createReadStream(src).pipe(_fs().default.createWriteStream(dest)).on('finish', callback);
|
||||
});
|
||||
}
|
||||
|
||||
var _default = saveAssets;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=saveAssets.js.map
|
32
node_modules/@react-native-community/cli/build/commands/config/config.js
generated
vendored
Normal file
32
node_modules/@react-native-community/cli/build/commands/config/config.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function isValidRNDependency(config) {
|
||||
return Object.keys(config.platforms).filter(key => Boolean(config.platforms[key])).length !== 0 || config.hooks && Object.keys(config.hooks).length !== 0 || config.assets && config.assets.length !== 0 || config.params && config.params.length !== 0;
|
||||
}
|
||||
|
||||
function filterConfig(config) {
|
||||
const filtered = { ...config
|
||||
};
|
||||
Object.keys(filtered.dependencies).forEach(item => {
|
||||
if (!isValidRNDependency(filtered.dependencies[item])) {
|
||||
delete filtered.dependencies[item];
|
||||
}
|
||||
});
|
||||
return filtered;
|
||||
}
|
||||
|
||||
var _default = {
|
||||
name: 'config',
|
||||
description: 'Print CLI configuration',
|
||||
func: async (_argv, ctx) => {
|
||||
console.log(JSON.stringify(filterConfig(ctx), null, 2));
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=config.js.map
|
60
node_modules/@react-native-community/cli/build/commands/doctor/checkInstallation.js
generated
vendored
Normal file
60
node_modules/@react-native-community/cli/build/commands/doctor/checkInstallation.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.doesSoftwareNeedToBeFixed = exports.isSoftwareNotInstalled = exports.PACKAGE_MANAGERS = void 0;
|
||||
|
||||
function _semver() {
|
||||
const data = _interopRequireDefault(require("semver"));
|
||||
|
||||
_semver = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _commandExists() {
|
||||
const data = _interopRequireDefault(require("command-exists"));
|
||||
|
||||
_commandExists = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
let PACKAGE_MANAGERS;
|
||||
exports.PACKAGE_MANAGERS = PACKAGE_MANAGERS;
|
||||
|
||||
(function (PACKAGE_MANAGERS) {
|
||||
PACKAGE_MANAGERS["YARN"] = "YARN";
|
||||
PACKAGE_MANAGERS["NPM"] = "NPM";
|
||||
})(PACKAGE_MANAGERS || (exports.PACKAGE_MANAGERS = PACKAGE_MANAGERS = {}));
|
||||
|
||||
const isSoftwareNotInstalled = async command => {
|
||||
try {
|
||||
await (0, _commandExists().default)(command);
|
||||
return false;
|
||||
} catch (_ignored) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
exports.isSoftwareNotInstalled = isSoftwareNotInstalled;
|
||||
|
||||
const doesSoftwareNeedToBeFixed = ({
|
||||
version,
|
||||
versionRange
|
||||
}) => {
|
||||
const coercedVersion = _semver().default.coerce(version);
|
||||
|
||||
return version === 'Not Found' || coercedVersion === null || !_semver().default.satisfies(coercedVersion, versionRange);
|
||||
};
|
||||
|
||||
exports.doesSoftwareNeedToBeFixed = doesSoftwareNeedToBeFixed;
|
||||
|
||||
//# sourceMappingURL=checkInstallation.js.map
|
257
node_modules/@react-native-community/cli/build/commands/doctor/doctor.js
generated
vendored
Normal file
257
node_modules/@react-native-community/cli/build/commands/doctor/doctor.js
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
"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 _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _healthchecks = require("./healthchecks");
|
||||
|
||||
var _loader = require("../../tools/loader");
|
||||
|
||||
var _printFixOptions = _interopRequireWildcard(require("./printFixOptions"));
|
||||
|
||||
var _runAutomaticFix = _interopRequireWildcard(require("./runAutomaticFix"));
|
||||
|
||||
var _envinfo = _interopRequireDefault(require("../../tools/envinfo"));
|
||||
|
||||
var _common = require("./healthchecks/common");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const printCategory = ({
|
||||
label,
|
||||
key
|
||||
}) => {
|
||||
if (key > 0) {
|
||||
_cliTools().logger.log();
|
||||
}
|
||||
|
||||
_cliTools().logger.log(_chalk().default.dim(label));
|
||||
};
|
||||
|
||||
const printVersions = ({
|
||||
version,
|
||||
versions,
|
||||
versionRange
|
||||
}) => {
|
||||
if (versions) {
|
||||
const versionsToShow = Array.isArray(versions) ? versions.join(', ') : 'N/A';
|
||||
(0, _common.logMessage)(`- Versions found: ${_chalk().default.red(versionsToShow)}`);
|
||||
(0, _common.logMessage)(`- Version supported: ${_chalk().default.green(versionRange)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const versionsToShow = version && version !== 'Not Found' ? version : 'N/A';
|
||||
(0, _common.logMessage)(`- Version found: ${_chalk().default.red(versionsToShow)}`);
|
||||
(0, _common.logMessage)(`- Version supported: ${_chalk().default.green(versionRange)}`);
|
||||
return;
|
||||
};
|
||||
|
||||
const printIssue = ({
|
||||
label,
|
||||
needsToBeFixed,
|
||||
version,
|
||||
versions,
|
||||
versionRange,
|
||||
isRequired,
|
||||
description
|
||||
}) => {
|
||||
const symbol = needsToBeFixed ? isRequired ? _chalk().default.red('✖') : _chalk().default.yellow('●') : _chalk().default.green('✓');
|
||||
const descriptionToShow = description ? ` - ${description}` : '';
|
||||
|
||||
_cliTools().logger.log(` ${symbol} ${label}${descriptionToShow}`);
|
||||
|
||||
if (needsToBeFixed && versionRange) {
|
||||
return printVersions({
|
||||
version,
|
||||
versions,
|
||||
versionRange
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const printOverallStats = ({
|
||||
errors,
|
||||
warnings
|
||||
}) => {
|
||||
_cliTools().logger.log(`\n${_chalk().default.bold('Errors:')} ${errors}`);
|
||||
|
||||
_cliTools().logger.log(`${_chalk().default.bold('Warnings:')} ${warnings}`);
|
||||
};
|
||||
|
||||
/**
|
||||
* Given a `healthcheck` and a `platform`, returns the specific fix for
|
||||
* it or the fallback one if there is not one (`runAutomaticFix`).
|
||||
*/
|
||||
const getAutomaticFixForPlatform = (healthcheck, platform) => {
|
||||
switch (platform) {
|
||||
case 'win32':
|
||||
return healthcheck.win32AutomaticFix || healthcheck.runAutomaticFix;
|
||||
|
||||
case 'darwin':
|
||||
return healthcheck.darwinAutomaticFix || healthcheck.runAutomaticFix;
|
||||
|
||||
case 'linux':
|
||||
return healthcheck.linuxAutomaticFix || healthcheck.runAutomaticFix;
|
||||
|
||||
default:
|
||||
return healthcheck.runAutomaticFix;
|
||||
}
|
||||
};
|
||||
|
||||
var _default = async (_, options) => {
|
||||
const Loader = (0, _loader.getLoader)();
|
||||
const loader = new Loader();
|
||||
loader.start('Running diagnostics...');
|
||||
const environmentInfo = await (0, _envinfo.default)();
|
||||
|
||||
const iterateOverHealthChecks = async ({
|
||||
label,
|
||||
healthchecks
|
||||
}) => ({
|
||||
label,
|
||||
healthchecks: (await Promise.all(healthchecks.map(async healthcheck => {
|
||||
if (healthcheck.visible === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
needsToBeFixed,
|
||||
version,
|
||||
versions,
|
||||
versionRange
|
||||
} = await healthcheck.getDiagnostics(environmentInfo); // Assume that it's required unless specified otherwise
|
||||
|
||||
const isRequired = healthcheck.isRequired !== false;
|
||||
const isWarning = needsToBeFixed && !isRequired;
|
||||
return {
|
||||
label: healthcheck.label,
|
||||
needsToBeFixed: Boolean(needsToBeFixed),
|
||||
version,
|
||||
versions,
|
||||
versionRange,
|
||||
description: healthcheck.description,
|
||||
runAutomaticFix: getAutomaticFixForPlatform(healthcheck, process.platform),
|
||||
isRequired,
|
||||
type: needsToBeFixed ? isWarning ? _healthchecks.HEALTHCHECK_TYPES.WARNING : _healthchecks.HEALTHCHECK_TYPES.ERROR : undefined
|
||||
};
|
||||
}))).filter(healthcheck => healthcheck !== undefined)
|
||||
}); // Remove all the categories that don't have any healthcheck with
|
||||
// `needsToBeFixed` so they don't show when the user taps to fix encountered
|
||||
// issues
|
||||
|
||||
|
||||
const removeFixedCategories = categories => categories.filter(category => category.healthchecks.some(healthcheck => healthcheck.needsToBeFixed));
|
||||
|
||||
const iterateOverCategories = categories => Promise.all(categories.map(iterateOverHealthChecks));
|
||||
|
||||
const healthchecksPerCategory = await iterateOverCategories(Object.values((0, _healthchecks.getHealthchecks)(options)).filter(category => category !== undefined));
|
||||
loader.stop();
|
||||
const stats = {
|
||||
errors: 0,
|
||||
warnings: 0
|
||||
};
|
||||
healthchecksPerCategory.forEach((issueCategory, key) => {
|
||||
printCategory({ ...issueCategory,
|
||||
key
|
||||
});
|
||||
issueCategory.healthchecks.forEach(healthcheck => {
|
||||
printIssue(healthcheck);
|
||||
|
||||
if (healthcheck.type === _healthchecks.HEALTHCHECK_TYPES.WARNING) {
|
||||
stats.warnings++;
|
||||
return;
|
||||
}
|
||||
|
||||
if (healthcheck.type === _healthchecks.HEALTHCHECK_TYPES.ERROR) {
|
||||
stats.errors++;
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
printOverallStats(stats);
|
||||
|
||||
if (options.fix) {
|
||||
return await (0, _runAutomaticFix.default)({
|
||||
healthchecks: removeFixedCategories(healthchecksPerCategory),
|
||||
automaticFixLevel: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.ALL_ISSUES,
|
||||
stats,
|
||||
loader,
|
||||
environmentInfo
|
||||
});
|
||||
}
|
||||
|
||||
const removeKeyPressListener = () => {
|
||||
if (typeof process.stdin.setRawMode === 'function') {
|
||||
process.stdin.setRawMode(false);
|
||||
}
|
||||
|
||||
process.stdin.removeAllListeners('data');
|
||||
};
|
||||
|
||||
const onKeyPress = async key => {
|
||||
if (key === _printFixOptions.KEYS.EXIT || key === '\u0003') {
|
||||
removeKeyPressListener();
|
||||
process.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if ([_printFixOptions.KEYS.FIX_ALL_ISSUES, _printFixOptions.KEYS.FIX_ERRORS, _printFixOptions.KEYS.FIX_WARNINGS].includes(key)) {
|
||||
removeKeyPressListener();
|
||||
|
||||
try {
|
||||
const automaticFixLevel = {
|
||||
[_printFixOptions.KEYS.FIX_ALL_ISSUES]: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.ALL_ISSUES,
|
||||
[_printFixOptions.KEYS.FIX_ERRORS]: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.ERRORS,
|
||||
[_printFixOptions.KEYS.FIX_WARNINGS]: _runAutomaticFix.AUTOMATIC_FIX_LEVELS.WARNINGS
|
||||
};
|
||||
await (0, _runAutomaticFix.default)({
|
||||
healthchecks: removeFixedCategories(healthchecksPerCategory),
|
||||
automaticFixLevel: automaticFixLevel[key],
|
||||
stats,
|
||||
loader,
|
||||
environmentInfo
|
||||
});
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
// TODO: log error
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (stats.errors || stats.warnings) {
|
||||
(0, _printFixOptions.default)({
|
||||
onKeyPress
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=doctor.js.map
|
55
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidHomeEnvVariable.js
generated
vendored
Normal file
55
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidHomeEnvVariable.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// List of answers on how to set `ANDROID_HOME` for each platform
|
||||
const URLS = {
|
||||
darwin: 'https://stackoverflow.com/a/28296325/4252781',
|
||||
win32: 'https://stackoverflow.com/a/54888107/4252781',
|
||||
linux: 'https://stackoverflow.com/a/39228100/4252781'
|
||||
};
|
||||
const label = 'ANDROID_HOME'; // Force the options for the platform to avoid providing a link
|
||||
// for `ANDROID_HOME` for every platform NodeJS supports
|
||||
|
||||
const platform = process.platform;
|
||||
const message = `Read more about how to set the ${label} at ${_chalk().default.dim(URLS[platform])}`;
|
||||
var _default = {
|
||||
label,
|
||||
getDiagnostics: async () => ({
|
||||
needsToBeFixed: !process.env.ANDROID_HOME
|
||||
}),
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
// Variable could have been added if installing Android Studio so double checking
|
||||
if (process.env.ANDROID_HOME) {
|
||||
loader.succeed();
|
||||
return;
|
||||
}
|
||||
|
||||
loader.fail();
|
||||
(0, _common.logManualInstallation)({
|
||||
message
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=androidHomeEnvVariable.js.map
|
65
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidNDK.js
generated
vendored
Normal file
65
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidNDK.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
label: 'Android NDK',
|
||||
description: 'Required for building React Native from the source',
|
||||
getDiagnostics: async ({
|
||||
SDKs
|
||||
}) => {
|
||||
const androidSdk = SDKs['Android SDK'];
|
||||
const version = androidSdk === 'Not Found' ? androidSdk : androidSdk['Android NDK'];
|
||||
return {
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version,
|
||||
versionRange: _versionRanges.default.ANDROID_NDK
|
||||
}),
|
||||
version,
|
||||
versionRange: _versionRanges.default.ANDROID_NDK
|
||||
};
|
||||
},
|
||||
runAutomaticFix: async ({
|
||||
loader,
|
||||
environmentInfo
|
||||
}) => {
|
||||
const androidSdk = environmentInfo.SDKs['Android SDK'];
|
||||
const isNDKInstalled = androidSdk !== 'Not Found' && androidSdk['Android NDK'] !== 'Not Found';
|
||||
loader.fail();
|
||||
|
||||
if (isNDKInstalled) {
|
||||
return (0, _common.logManualInstallation)({
|
||||
message: `Read more about how to update Android NDK at ${_chalk().default.dim('https://developer.android.com/ndk/downloads')}`
|
||||
});
|
||||
}
|
||||
|
||||
return (0, _common.logManualInstallation)({
|
||||
healthcheck: 'Android NDK',
|
||||
url: 'https://developer.android.com/ndk/downloads'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=androidNDK.js.map
|
198
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidSDK.js
generated
vendored
Normal file
198
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidSDK.js
generated
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
"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 _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;
|
||||
}
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
var _findProjectRoot = _interopRequireDefault(require("../../../tools/config/findProjectRoot"));
|
||||
|
||||
var _androidWinHelpers = require("../../../tools/windows/androidWinHelpers");
|
||||
|
||||
var _downloadAndUnzip = require("../../../tools/downloadAndUnzip");
|
||||
|
||||
var _environmentVariables = require("../../../tools/windows/environmentVariables");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const getBuildToolsVersion = () => {
|
||||
let projectRoot = '';
|
||||
|
||||
try {
|
||||
// doctor is a detached command, so we may not be in a RN project.
|
||||
projectRoot = (0, _findProjectRoot.default)();
|
||||
} catch (_unused) {
|
||||
_cliTools().logger.log(); // for extra space
|
||||
|
||||
|
||||
_cliTools().logger.warn("We couldn't find a package.json in this directory. Android SDK checks may fail. Doctor works best in a React Native project root.");
|
||||
}
|
||||
|
||||
const gradleBuildFilePath = _path().default.join(projectRoot, 'android/build.gradle');
|
||||
|
||||
const buildToolsVersionEntry = 'buildToolsVersion';
|
||||
|
||||
if (!_fs().default.existsSync(gradleBuildFilePath)) {
|
||||
return 'Not Found';
|
||||
} // Read the content of the `build.gradle` file
|
||||
|
||||
|
||||
const gradleBuildFile = _fs().default.readFileSync(gradleBuildFilePath, 'utf-8');
|
||||
|
||||
const buildToolsVersionIndex = gradleBuildFile.indexOf(buildToolsVersionEntry);
|
||||
const buildToolsVersion = (gradleBuildFile // Get only the portion of the declaration of `buildToolsVersion`
|
||||
.substring(buildToolsVersionIndex).split('\n')[0] // Get only the the value of `buildToolsVersion`
|
||||
.match(/\d|\../g) || []).join('');
|
||||
return buildToolsVersion || 'Not Found';
|
||||
};
|
||||
|
||||
const installMessage = `Read more about how to update Android SDK at ${_chalk().default.dim('https://developer.android.com/studio')}`;
|
||||
|
||||
const isSDKInstalled = environmentInfo => {
|
||||
const version = environmentInfo.SDKs['Android SDK'];
|
||||
return version !== 'Not Found';
|
||||
};
|
||||
|
||||
var _default = {
|
||||
label: 'Android SDK',
|
||||
description: 'Required for building and installing your app on Android',
|
||||
getDiagnostics: async ({
|
||||
SDKs
|
||||
}) => {
|
||||
const requiredVersion = getBuildToolsVersion();
|
||||
const buildTools = typeof SDKs['Android SDK'] === 'string' ? SDKs['Android SDK'] : SDKs['Android SDK']['Build Tools'];
|
||||
const isAndroidSDKInstalled = Array.isArray(buildTools);
|
||||
const isRequiredVersionInstalled = isAndroidSDKInstalled ? buildTools.includes(requiredVersion) : false;
|
||||
return {
|
||||
versions: isAndroidSDKInstalled ? buildTools : SDKs['Android SDK'],
|
||||
versionRange: requiredVersion,
|
||||
needsToBeFixed: !isRequiredVersionInstalled
|
||||
};
|
||||
},
|
||||
win32AutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
// Need a GitHub action to update automatically. See #1180
|
||||
const cliToolsUrl = 'https://dl.google.com/android/repository/commandlinetools-win-6200805_latest.zip';
|
||||
const systemImage = 'system-images;android-28;google_apis;x86_64'; // Installing 29 as well so Android Studio does not complain on first boot
|
||||
|
||||
const componentsToInstall = ['platform-tools', 'build-tools;29.0.3', 'platforms;android-29', // Is 28 still needed?
|
||||
'build-tools;28.0.3', 'platforms;android-28', 'emulator', systemImage, '--licenses' // Accept any pending licenses at the end
|
||||
];
|
||||
const androidSDKRoot = (0, _androidWinHelpers.getAndroidSdkRootInstallation)();
|
||||
|
||||
if (androidSDKRoot === '') {
|
||||
loader.fail('There was an error finding the Android SDK root');
|
||||
return;
|
||||
}
|
||||
|
||||
await (0, _downloadAndUnzip.downloadAndUnzip)({
|
||||
loader,
|
||||
downloadUrl: cliToolsUrl,
|
||||
component: 'Android Command Line Tools',
|
||||
installPath: androidSDKRoot
|
||||
});
|
||||
|
||||
for (const component of componentsToInstall) {
|
||||
loader.text = `Installing "${component}" (this may take a few minutes)`;
|
||||
|
||||
try {
|
||||
await (0, _androidWinHelpers.installComponent)(component, androidSDKRoot);
|
||||
} catch (e) {// Is there a way to persist a line in loader and continue the execution?
|
||||
}
|
||||
}
|
||||
|
||||
loader.text = 'Updating environment variables'; // Required for the emulator to work from the CLI
|
||||
|
||||
await (0, _environmentVariables.setEnvironment)('ANDROID_SDK_ROOT', androidSDKRoot);
|
||||
await (0, _environmentVariables.setEnvironment)('ANDROID_HOME', androidSDKRoot);
|
||||
await (0, _environmentVariables.updateEnvironment)('PATH', _path().default.join(androidSDKRoot, 'tools'));
|
||||
await (0, _environmentVariables.updateEnvironment)('PATH', _path().default.join(androidSDKRoot, 'platform-tools'));
|
||||
loader.text = 'Configuring Hypervisor for faster emulation, this might prompt UAC';
|
||||
const {
|
||||
hypervisor,
|
||||
installed
|
||||
} = await (0, _androidWinHelpers.getBestHypervisor)(androidSDKRoot);
|
||||
|
||||
if (!installed) {
|
||||
if (hypervisor === 'none') {
|
||||
loader.warn('Android SDK configured but virtualization could not be enabled.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (hypervisor === 'AMDH') {
|
||||
await (0, _androidWinHelpers.enableAMDH)(androidSDKRoot);
|
||||
} else if (hypervisor === 'HAXM') {
|
||||
await (0, _androidWinHelpers.enableHAXM)(androidSDKRoot);
|
||||
} else if (hypervisor === 'WHPX') {
|
||||
await (0, _androidWinHelpers.enableWHPX)();
|
||||
}
|
||||
}
|
||||
|
||||
loader.text = 'Creating AVD';
|
||||
await (0, _androidWinHelpers.createAVD)(androidSDKRoot, 'pixel_9.0', 'pixel', systemImage);
|
||||
loader.succeed('Android SDK configured. You might need to restart your PC for all changes to take effect.');
|
||||
},
|
||||
runAutomaticFix: async ({
|
||||
loader,
|
||||
environmentInfo
|
||||
}) => {
|
||||
loader.fail();
|
||||
|
||||
if (isSDKInstalled(environmentInfo)) {
|
||||
return (0, _common.logManualInstallation)({
|
||||
message: installMessage
|
||||
});
|
||||
}
|
||||
|
||||
return (0, _common.logManualInstallation)({
|
||||
healthcheck: 'Android SDK',
|
||||
url: 'https://reactnative.dev/docs/getting-started'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=androidSDK.js.map
|
92
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidStudio.js
generated
vendored
Normal file
92
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/androidStudio.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
var _downloadAndUnzip = require("../../../tools/downloadAndUnzip");
|
||||
|
||||
var _executeWinCommand = require("../../../tools/windows/executeWinCommand");
|
||||
|
||||
var _androidWinHelpers = require("../../../tools/windows/androidWinHelpers");
|
||||
|
||||
var _createShortcut = require("../../../tools/windows/create-shortcut");
|
||||
|
||||
var _default = {
|
||||
label: 'Android Studio',
|
||||
description: 'Required for building and installing your app on Android',
|
||||
getDiagnostics: async ({
|
||||
IDEs
|
||||
}) => {
|
||||
const needsToBeFixed = IDEs['Android Studio'] === 'Not Found';
|
||||
const missing = {
|
||||
needsToBeFixed,
|
||||
version: IDEs['Android Studio']
|
||||
}; // On Windows `doctor` installs Android Studio locally in a well-known place
|
||||
|
||||
if (needsToBeFixed && process.platform === 'win32') {
|
||||
const androidStudioPath = (0, _path().join)((0, _androidWinHelpers.getUserAndroidPath)(), 'android-studio', 'bin', 'studio.exe').replace(/\\/g, '\\\\');
|
||||
const {
|
||||
stdout
|
||||
} = await (0, _executeWinCommand.executeCommand)(`wmic datafile where name="${androidStudioPath}" get Version`);
|
||||
const version = stdout.replace(/(\r\n|\n|\r)/gm, '').trim();
|
||||
|
||||
if (version === '') {
|
||||
return missing;
|
||||
}
|
||||
|
||||
return {
|
||||
needsToBeFixed: false,
|
||||
version
|
||||
};
|
||||
}
|
||||
|
||||
return missing;
|
||||
},
|
||||
win32AutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
// Need a GitHub action to update automatically. See #1180
|
||||
const androidStudioUrl = 'https://redirector.gvt1.com/edgedl/android/studio/ide-zips/3.6.3.0/android-studio-ide-192.6392135-windows.zip';
|
||||
const installPath = (0, _androidWinHelpers.getUserAndroidPath)();
|
||||
await (0, _downloadAndUnzip.downloadAndUnzip)({
|
||||
loader,
|
||||
downloadUrl: androidStudioUrl,
|
||||
component: 'Android Studio',
|
||||
installPath: installPath
|
||||
});
|
||||
const prefix = process.arch === 'x64' ? '64' : '';
|
||||
const binFolder = (0, _path().join)(installPath, 'android-studio', 'bin');
|
||||
await (0, _createShortcut.createShortcut)({
|
||||
path: (0, _path().join)(binFolder, `studio${prefix}.exe`),
|
||||
name: 'Android Studio',
|
||||
ico: (0, _path().join)(binFolder, 'studio.ico')
|
||||
});
|
||||
loader.succeed(`Android Studio installed successfully in "${installPath}".`);
|
||||
},
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
loader.fail();
|
||||
return (0, _common.logManualInstallation)({
|
||||
healthcheck: 'Android Studio',
|
||||
url: 'https://reactnative.dev/docs/environment-setup'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=androidStudio.js.map
|
86
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/cocoaPods.js
generated
vendored
Normal file
86
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/cocoaPods.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _installPods = require("../../../tools/installPods");
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
var _brewInstall = require("../../../tools/brewInstall");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const label = 'CocoaPods';
|
||||
var _default = {
|
||||
label,
|
||||
description: 'Required for installing iOS dependencies',
|
||||
getDiagnostics: async () => ({
|
||||
needsToBeFixed: await (0, _checkInstallation.isSoftwareNotInstalled)('pod')
|
||||
}),
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
loader.stop();
|
||||
const {
|
||||
installMethod,
|
||||
promptQuestion
|
||||
} = await (0, _installPods.promptCocoaPodsInstallationQuestion)(); // Capitalise `Homebrew` when printing on the screen
|
||||
|
||||
const installMethodCapitalized = installMethod === 'homebrew' ? installMethod.substr(0, 1).toUpperCase() + installMethod.substr(1) : installMethod;
|
||||
const loaderInstallationMessage = `${label} (installing with ${installMethodCapitalized})`;
|
||||
const loaderSucceedMessage = `${label} (installed with ${installMethodCapitalized})`; // Remove the prompt after the question of how to install CocoaPods is answered
|
||||
|
||||
(0, _common.removeMessage)(promptQuestion);
|
||||
|
||||
if (installMethod === 'gem') {
|
||||
loader.start(loaderInstallationMessage);
|
||||
const options = ['install', 'cocoapods', '--no-document'];
|
||||
|
||||
try {
|
||||
// First attempt to install `cocoapods`
|
||||
await (0, _execa().default)('gem', options);
|
||||
return loader.succeed(loaderSucceedMessage);
|
||||
} catch (_error) {
|
||||
// If that doesn't work then try with sudo
|
||||
try {
|
||||
await (0, _installPods.runSudo)(`gem ${options.join(' ')}`);
|
||||
return loader.succeed(loaderSucceedMessage);
|
||||
} catch (error) {
|
||||
(0, _common.logError)({
|
||||
healthcheck: label,
|
||||
loader,
|
||||
error,
|
||||
command: 'sudo gem install cocoapods'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (installMethod === 'homebrew') {
|
||||
return await (0, _brewInstall.brewInstall)({
|
||||
pkg: 'cocoapods',
|
||||
label: loaderInstallationMessage,
|
||||
loader,
|
||||
onSuccess: () => loader.succeed(loaderSucceedMessage)
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=cocoaPods.js.map
|
139
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/common.js
generated
vendored
Normal file
139
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/common.js
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.removeMessage = removeMessage;
|
||||
exports.logError = exports.logManualInstallation = exports.logMessage = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _readline() {
|
||||
const data = _interopRequireDefault(require("readline"));
|
||||
|
||||
_readline = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _wcwidth() {
|
||||
const data = _interopRequireDefault(require("wcwidth"));
|
||||
|
||||
_wcwidth = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _stripAnsi() {
|
||||
const data = _interopRequireDefault(require("strip-ansi"));
|
||||
|
||||
_stripAnsi = 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 }; }
|
||||
|
||||
// Space is necessary to keep correct ordering on screen
|
||||
const logMessage = message => {
|
||||
const indentation = ' ';
|
||||
|
||||
if (typeof message !== 'string') {
|
||||
_cliTools().logger.log();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const messageByLine = message.split('\n');
|
||||
return _cliTools().logger.log(`${indentation}${messageByLine.join(`\n${indentation}`)}`);
|
||||
};
|
||||
|
||||
exports.logMessage = logMessage;
|
||||
|
||||
const addBlankLine = () => logMessage();
|
||||
|
||||
const logManualInstallation = ({
|
||||
healthcheck,
|
||||
url,
|
||||
command,
|
||||
message
|
||||
}) => {
|
||||
if (message) {
|
||||
return logMessage(message);
|
||||
}
|
||||
|
||||
if (url) {
|
||||
logMessage(`Read more about how to download ${healthcheck} at ${_chalk().default.dim.underline(url)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (command) {
|
||||
logMessage(`Please install ${healthcheck} by running ${_chalk().default.bold(command)}`);
|
||||
}
|
||||
};
|
||||
|
||||
exports.logManualInstallation = logManualInstallation;
|
||||
|
||||
const logError = ({
|
||||
healthcheck,
|
||||
loader,
|
||||
error,
|
||||
message,
|
||||
command
|
||||
}) => {
|
||||
if (loader) {
|
||||
loader.fail();
|
||||
}
|
||||
|
||||
addBlankLine();
|
||||
logMessage(_chalk().default.dim(error.message));
|
||||
|
||||
if (message) {
|
||||
logMessage(message);
|
||||
addBlankLine();
|
||||
return;
|
||||
}
|
||||
|
||||
logMessage(`The error above occured while trying to install ${healthcheck}. Please try again manually: ${_chalk().default.bold(command)}`);
|
||||
addBlankLine();
|
||||
}; // Calculate the size of a message on terminal based on rows
|
||||
|
||||
|
||||
exports.logError = logError;
|
||||
|
||||
function calculateMessageSize(message) {
|
||||
return Math.max(1, Math.ceil((0, _wcwidth().default)((0, _stripAnsi().default)(message)) / (process.stdout.columns || 80)));
|
||||
} // Clear the message from the terminal
|
||||
|
||||
|
||||
function removeMessage(message) {
|
||||
_readline().default.moveCursor(process.stdout, 0, -calculateMessageSize(message));
|
||||
|
||||
_readline().default.clearScreenDown(process.stdout);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=common.js.map
|
61
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/index.js
generated
vendored
Normal file
61
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/index.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getHealthchecks = exports.HEALTHCHECK_TYPES = void 0;
|
||||
|
||||
var _nodeJS = _interopRequireDefault(require("./nodeJS"));
|
||||
|
||||
var _packageManagers = require("./packageManagers");
|
||||
|
||||
var _jdk = _interopRequireDefault(require("./jdk"));
|
||||
|
||||
var _python = _interopRequireDefault(require("./python"));
|
||||
|
||||
var _watchman = _interopRequireDefault(require("./watchman"));
|
||||
|
||||
var _androidHomeEnvVariable = _interopRequireDefault(require("./androidHomeEnvVariable"));
|
||||
|
||||
var _androidStudio = _interopRequireDefault(require("./androidStudio"));
|
||||
|
||||
var _androidSDK = _interopRequireDefault(require("./androidSDK"));
|
||||
|
||||
var _androidNDK = _interopRequireDefault(require("./androidNDK"));
|
||||
|
||||
var _xcode = _interopRequireDefault(require("./xcode"));
|
||||
|
||||
var _cocoaPods = _interopRequireDefault(require("./cocoaPods"));
|
||||
|
||||
var _iosDeploy = _interopRequireDefault(require("./iosDeploy"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const HEALTHCHECK_TYPES = {
|
||||
ERROR: 'ERROR',
|
||||
WARNING: 'WARNING'
|
||||
};
|
||||
exports.HEALTHCHECK_TYPES = HEALTHCHECK_TYPES;
|
||||
|
||||
const getHealthchecks = ({
|
||||
contributor
|
||||
}) => ({
|
||||
common: {
|
||||
label: 'Common',
|
||||
healthchecks: [_nodeJS.default, _packageManagers.yarn, _packageManagers.npm, ...(process.platform === 'darwin' ? [_watchman.default] : []), ...(process.platform === 'win32' ? [_python.default] : [])]
|
||||
},
|
||||
android: {
|
||||
label: 'Android',
|
||||
healthchecks: [_jdk.default, _androidStudio.default, _androidSDK.default, _androidHomeEnvVariable.default, ...(contributor ? [_androidNDK.default] : [])]
|
||||
},
|
||||
...(process.platform === 'darwin' ? {
|
||||
ios: {
|
||||
label: 'iOS',
|
||||
healthchecks: [_xcode.default, _cocoaPods.default, _iosDeploy.default]
|
||||
}
|
||||
} : {})
|
||||
});
|
||||
|
||||
exports.getHealthchecks = getHealthchecks;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
138
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/iosDeploy.js
generated
vendored
Normal file
138
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/iosDeploy.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
"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 _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _inquirer() {
|
||||
const data = _interopRequireDefault(require("inquirer"));
|
||||
|
||||
_inquirer = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _packageManagers = require("./packageManagers");
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @ts-ignore untyped
|
||||
const label = 'ios-deploy';
|
||||
const installationWithYarn = 'yarn global add ios-deploy';
|
||||
const installationWithNpm = 'npm install ios-deploy --global';
|
||||
|
||||
const identifyInstallationCommand = () => {
|
||||
if (_packageManagers.packageManager === _checkInstallation.PACKAGE_MANAGERS.YARN) {
|
||||
return installationWithYarn;
|
||||
}
|
||||
|
||||
if (_packageManagers.packageManager === _checkInstallation.PACKAGE_MANAGERS.NPM) {
|
||||
return installationWithNpm;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const installLibrary = async ({
|
||||
installationCommand,
|
||||
packageManagerToUse,
|
||||
loader
|
||||
}) => {
|
||||
try {
|
||||
loader.start(`${label} (installing with ${packageManagerToUse})`);
|
||||
const installationCommandArgs = installationCommand.split(' ');
|
||||
await (0, _execa().default)(installationCommandArgs[0], installationCommandArgs.splice(1));
|
||||
loader.succeed(`${label} (installed with ${packageManagerToUse})`);
|
||||
} catch (error) {
|
||||
(0, _common.logError)({
|
||||
healthcheck: label,
|
||||
loader,
|
||||
error,
|
||||
command: installationCommand
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var _default = {
|
||||
label,
|
||||
isRequired: false,
|
||||
description: 'Required for installing your app on a physical device with the CLI',
|
||||
getDiagnostics: async () => ({
|
||||
needsToBeFixed: await (0, _checkInstallation.isSoftwareNotInstalled)('ios-deploy')
|
||||
}),
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
loader.stop();
|
||||
const installationCommand = identifyInstallationCommand(); // This means that we couldn't "guess" the package manager
|
||||
|
||||
if (installationCommand === undefined) {
|
||||
const promptQuestion = `ios-deploy needs to be installed either by ${_chalk().default.bold('yarn')} ${_chalk().default.reset('or')} ${_chalk().default.bold('npm')} ${_chalk().default.reset()}, which one do you want to use?`;
|
||||
const installWithYarn = 'yarn';
|
||||
const installWithNpm = 'npm';
|
||||
const skipInstallation = 'Skip installation';
|
||||
const {
|
||||
chosenPackageManager
|
||||
} = await _inquirer().default.prompt([{
|
||||
type: 'list',
|
||||
name: 'chosenPackageManager',
|
||||
message: promptQuestion,
|
||||
choices: [installWithYarn, installWithNpm, skipInstallation]
|
||||
}]);
|
||||
(0, _common.removeMessage)(`? ${promptQuestion} ${chosenPackageManager}`);
|
||||
|
||||
if (chosenPackageManager === skipInstallation) {
|
||||
loader.fail(); // Then we just print out the URL that the user can head to download the library
|
||||
|
||||
(0, _common.logManualInstallation)({
|
||||
healthcheck: 'ios-deploy',
|
||||
url: 'https://github.com/ios-control/ios-deploy#readme'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const shouldInstallWithYarn = chosenPackageManager === installWithYarn;
|
||||
return installLibrary({
|
||||
installationCommand: shouldInstallWithYarn ? installationWithYarn : installationWithNpm,
|
||||
loader,
|
||||
packageManagerToUse: chosenPackageManager
|
||||
});
|
||||
}
|
||||
|
||||
return installLibrary({
|
||||
installationCommand,
|
||||
packageManagerToUse: _packageManagers.packageManager.toLowerCase(),
|
||||
loader
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=iosDeploy.js.map
|
74
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/jdk.js
generated
vendored
Normal file
74
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/jdk.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
var _downloadAndUnzip = require("../../../tools/downloadAndUnzip");
|
||||
|
||||
var _environmentVariables = require("../../../tools/windows/environmentVariables");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
label: 'JDK',
|
||||
getDiagnostics: async ({
|
||||
Languages
|
||||
}) => ({
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version: typeof Languages.Java === 'string' ? Languages.Java : Languages.Java.version,
|
||||
versionRange: _versionRanges.default.JAVA
|
||||
}),
|
||||
version: typeof Languages.Java === 'string' ? Languages.Java : Languages.Java.version,
|
||||
versionRange: _versionRanges.default.JAVA
|
||||
}),
|
||||
win32AutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
try {
|
||||
// Installing JDK 11 because later versions seem to cause issues with gradle at the moment
|
||||
const installerUrl = 'https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_windows-x64_bin.zip';
|
||||
const installPath = process.env.LOCALAPPDATA || ''; // The zip is in a folder `jdk-11.02` so it can be unzipped directly there
|
||||
|
||||
await (0, _downloadAndUnzip.downloadAndUnzip)({
|
||||
loader,
|
||||
downloadUrl: installerUrl,
|
||||
component: 'JDK',
|
||||
installPath
|
||||
});
|
||||
loader.text = 'Updating environment variables';
|
||||
const jdkPath = (0, _path().join)(installPath, 'jdk-11.0.2');
|
||||
await (0, _environmentVariables.setEnvironment)('JAVA_HOME', jdkPath);
|
||||
await (0, _environmentVariables.updateEnvironment)('PATH', (0, _path().join)(jdkPath, 'bin'));
|
||||
loader.succeed('JDK installed successfully. Please restart your shell to see the changes');
|
||||
} catch (e) {
|
||||
loader.fail(e);
|
||||
}
|
||||
},
|
||||
runAutomaticFix: async () => {
|
||||
(0, _common.logManualInstallation)({
|
||||
healthcheck: 'JDK',
|
||||
url: 'https://openjdk.java.net/'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=jdk.js.map
|
40
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/nodeJS.js
generated
vendored
Normal file
40
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/nodeJS.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
label: 'Node.js',
|
||||
getDiagnostics: async ({
|
||||
Binaries
|
||||
}) => ({
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version: Binaries.Node.version,
|
||||
versionRange: _versionRanges.default.NODE_JS
|
||||
}),
|
||||
version: Binaries.Node.version,
|
||||
versionRange: _versionRanges.default.NODE_JS
|
||||
}),
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
loader.fail();
|
||||
(0, _common.logManualInstallation)({
|
||||
healthcheck: 'Node.js',
|
||||
url: 'https://nodejs.org/en/download/'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=nodeJS.js.map
|
90
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/packageManagers.js
generated
vendored
Normal file
90
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/packageManagers.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.npm = exports.yarn = exports.packageManager = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _install = require("../../../tools/install");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const packageManager = (() => {
|
||||
if (_fs().default.existsSync('yarn.lock')) {
|
||||
return _checkInstallation.PACKAGE_MANAGERS.YARN;
|
||||
}
|
||||
|
||||
if (_fs().default.existsSync('package-lock.json')) {
|
||||
return _checkInstallation.PACKAGE_MANAGERS.NPM;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
})();
|
||||
|
||||
exports.packageManager = packageManager;
|
||||
const yarn = {
|
||||
label: 'yarn',
|
||||
getDiagnostics: async ({
|
||||
Binaries
|
||||
}) => ({
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version: Binaries.Yarn.version,
|
||||
versionRange: _versionRanges.default.YARN
|
||||
}),
|
||||
version: Binaries.Yarn.version,
|
||||
versionRange: _versionRanges.default.YARN
|
||||
}),
|
||||
// Only show `yarn` if there's a `yarn.lock` file in the current directory
|
||||
// or if we can't identify that the user uses yarn or npm
|
||||
visible: packageManager === _checkInstallation.PACKAGE_MANAGERS.YARN || packageManager === undefined,
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => await (0, _install.install)({
|
||||
pkg: 'yarn',
|
||||
label: 'yarn',
|
||||
url: 'https://yarnpkg.com/docs/install',
|
||||
loader
|
||||
})
|
||||
};
|
||||
exports.yarn = yarn;
|
||||
const npm = {
|
||||
label: 'npm',
|
||||
getDiagnostics: async ({
|
||||
Binaries
|
||||
}) => ({
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version: Binaries.npm.version,
|
||||
versionRange: _versionRanges.default.NPM
|
||||
}),
|
||||
version: Binaries.npm.version,
|
||||
versionRange: _versionRanges.default.NPM
|
||||
}),
|
||||
// Only show `yarn` if there's a `package-lock.json` file in the current directory
|
||||
// or if we can't identify that the user uses yarn or npm
|
||||
visible: packageManager === _checkInstallation.PACKAGE_MANAGERS.NPM || packageManager === undefined,
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => await (0, _install.install)({
|
||||
pkg: 'node',
|
||||
label: 'node',
|
||||
url: 'https://nodejs.org/',
|
||||
loader
|
||||
})
|
||||
};
|
||||
exports.npm = npm;
|
||||
|
||||
//# sourceMappingURL=packageManagers.js.map
|
86
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/python.js
generated
vendored
Normal file
86
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/python.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
var _environmentVariables = require("../../../tools/windows/environmentVariables");
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _executeWinCommand = require("../../../tools/windows/executeWinCommand");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
label: 'Python',
|
||||
getDiagnostics: async ({
|
||||
Languages
|
||||
}) => ({
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version: typeof Languages.Python === 'string' ? Languages.Python : Languages.Python.version,
|
||||
versionRange: _versionRanges.default.PYTHON
|
||||
}),
|
||||
version: typeof Languages.Python === 'string' ? Languages.Python : Languages.Python.version,
|
||||
versionRange: _versionRanges.default.PYTHON
|
||||
}),
|
||||
win32AutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
try {
|
||||
const arch = process.arch === 'x64' ? 'amd64.' : '';
|
||||
const installerUrl = `https://www.python.org/ftp/python/2.7.9/python-2.7.9.${arch}msi`;
|
||||
const installPath = (0, _path().join)(process.env.LOCALAPPDATA || '', 'python2');
|
||||
loader.start(`Downloading Python installer from "${installerUrl}"`);
|
||||
const installer = await (0, _cliTools().fetchToTemp)(installerUrl);
|
||||
loader.text = `Installing Python in "${installPath}"`;
|
||||
const command = `msiexec.exe /i "${installer}" TARGETDIR="${installPath}" /qn /L*P "python-log.txt"`;
|
||||
await (0, _executeWinCommand.executeCommand)(command);
|
||||
loader.text = 'Updating environment variables';
|
||||
await (0, _environmentVariables.updateEnvironment)('PATH', installPath);
|
||||
await (0, _environmentVariables.updateEnvironment)('PATH', (0, _path().join)(installPath, 'scripts'));
|
||||
loader.succeed('Python installed successfully');
|
||||
} catch (e) {
|
||||
loader.fail(e);
|
||||
}
|
||||
},
|
||||
runAutomaticFix: async () => {
|
||||
/**
|
||||
* Python is only needed on Windows so this method should never be called.
|
||||
* Leaving it in case that changes and as an example of how to have a
|
||||
* fallback.
|
||||
*/
|
||||
(0, _common.logManualInstallation)({
|
||||
healthcheck: 'Python',
|
||||
url: 'https://www.python.org/downloads/'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=python.js.map
|
41
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/watchman.js
generated
vendored
Normal file
41
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/watchman.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _install = require("../../../tools/install");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const label = 'Watchman';
|
||||
var _default = {
|
||||
label,
|
||||
description: 'Used for watching changes in the filesystem when in development mode',
|
||||
getDiagnostics: async ({
|
||||
Binaries
|
||||
}) => ({
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version: Binaries.Watchman.version,
|
||||
versionRange: _versionRanges.default.WATCHMAN
|
||||
}),
|
||||
version: Binaries.Watchman.version,
|
||||
versionRange: _versionRanges.default.WATCHMAN
|
||||
}),
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => await (0, _install.install)({
|
||||
pkg: 'watchman',
|
||||
label,
|
||||
url: 'https://facebook.github.io/watchman/docs/install.html',
|
||||
loader
|
||||
})
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=watchman.js.map
|
44
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/xcode.js
generated
vendored
Normal file
44
node_modules/@react-native-community/cli/build/commands/doctor/healthchecks/xcode.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _versionRanges = _interopRequireDefault(require("../versionRanges"));
|
||||
|
||||
var _checkInstallation = require("../checkInstallation");
|
||||
|
||||
var _common = require("./common");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
label: 'Xcode',
|
||||
description: 'Required for building and installing your app on iOS',
|
||||
getDiagnostics: async ({
|
||||
IDEs
|
||||
}) => {
|
||||
const version = IDEs.Xcode.version.split('/')[0];
|
||||
return {
|
||||
needsToBeFixed: (0, _checkInstallation.doesSoftwareNeedToBeFixed)({
|
||||
version,
|
||||
versionRange: _versionRanges.default.XCODE
|
||||
}),
|
||||
version,
|
||||
versionRange: _versionRanges.default.XCODE
|
||||
};
|
||||
},
|
||||
runAutomaticFix: async ({
|
||||
loader
|
||||
}) => {
|
||||
loader.fail();
|
||||
(0, _common.logManualInstallation)({
|
||||
healthcheck: 'Xcode',
|
||||
url: 'https://developer.apple.com/xcode/'
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=xcode.js.map
|
27
node_modules/@react-native-community/cli/build/commands/doctor/index.js
generated
vendored
Normal file
27
node_modules/@react-native-community/cli/build/commands/doctor/index.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _doctor = _interopRequireDefault(require("./doctor"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
func: _doctor.default,
|
||||
detached: true,
|
||||
name: 'doctor',
|
||||
description: '[EXPERIMENTAL] Diagnose and fix common Node.js, iOS, Android & React Native issues.',
|
||||
options: [{
|
||||
name: '--fix',
|
||||
description: 'Attempt to fix all diagnosed issues.'
|
||||
}, {
|
||||
name: '--contributor',
|
||||
description: 'Add healthchecks required to installations required for contributing to React Native.'
|
||||
}]
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
67
node_modules/@react-native-community/cli/build/commands/doctor/printFixOptions.js
generated
vendored
Normal file
67
node_modules/@react-native-community/cli/build/commands/doctor/printFixOptions.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.KEYS = void 0;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const KEYS = {
|
||||
FIX_ALL_ISSUES: 'f',
|
||||
FIX_ERRORS: 'e',
|
||||
FIX_WARNINGS: 'w',
|
||||
EXIT: '\r'
|
||||
};
|
||||
exports.KEYS = KEYS;
|
||||
|
||||
const printOption = option => _cliTools().logger.log(` \u203A ${option}`);
|
||||
|
||||
const printOptions = () => {
|
||||
_cliTools().logger.log();
|
||||
|
||||
_cliTools().logger.log(_chalk().default.bold('Usage'));
|
||||
|
||||
printOption(`${_chalk().default.dim('Press')} ${KEYS.FIX_ALL_ISSUES} ${_chalk().default.dim('to try to fix issues.')}`);
|
||||
printOption(`${_chalk().default.dim('Press')} ${KEYS.FIX_ERRORS} ${_chalk().default.dim('to try to fix errors.')}`);
|
||||
printOption(`${_chalk().default.dim('Press')} ${KEYS.FIX_WARNINGS} ${_chalk().default.dim('to try to fix warnings.')}`);
|
||||
printOption(`${_chalk().default.dim('Press')} Enter ${_chalk().default.dim('to exit.')}`);
|
||||
};
|
||||
|
||||
var _default = ({
|
||||
onKeyPress
|
||||
}) => {
|
||||
printOptions();
|
||||
|
||||
if (process.stdin.setRawMode) {
|
||||
process.stdin.setRawMode(true);
|
||||
}
|
||||
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', onKeyPress);
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=printFixOptions.js.map
|
115
node_modules/@react-native-community/cli/build/commands/doctor/runAutomaticFix.js
generated
vendored
Normal file
115
node_modules/@react-native-community/cli/build/commands/doctor/runAutomaticFix.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
exports.AUTOMATIC_FIX_LEVELS = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _ora() {
|
||||
const data = _interopRequireDefault(require("ora"));
|
||||
|
||||
_ora = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _healthchecks = require("./healthchecks");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
let AUTOMATIC_FIX_LEVELS;
|
||||
exports.AUTOMATIC_FIX_LEVELS = AUTOMATIC_FIX_LEVELS;
|
||||
|
||||
(function (AUTOMATIC_FIX_LEVELS) {
|
||||
AUTOMATIC_FIX_LEVELS["ALL_ISSUES"] = "ALL_ISSUES";
|
||||
AUTOMATIC_FIX_LEVELS["ERRORS"] = "ERRORS";
|
||||
AUTOMATIC_FIX_LEVELS["WARNINGS"] = "WARNINGS";
|
||||
})(AUTOMATIC_FIX_LEVELS || (exports.AUTOMATIC_FIX_LEVELS = AUTOMATIC_FIX_LEVELS = {}));
|
||||
|
||||
async function _default({
|
||||
healthchecks,
|
||||
automaticFixLevel,
|
||||
stats,
|
||||
environmentInfo
|
||||
}) {
|
||||
// Remove the fix options from screen
|
||||
if (process.stdout.isTTY) {
|
||||
// @ts-ignore
|
||||
process.stdout.moveCursor(0, -6); // @ts-ignore
|
||||
|
||||
process.stdout.clearScreenDown();
|
||||
}
|
||||
|
||||
const totalIssuesBasedOnFixLevel = {
|
||||
[AUTOMATIC_FIX_LEVELS.ALL_ISSUES]: stats.errors + stats.warnings,
|
||||
[AUTOMATIC_FIX_LEVELS.ERRORS]: stats.errors,
|
||||
[AUTOMATIC_FIX_LEVELS.WARNINGS]: stats.warnings
|
||||
};
|
||||
const issuesCount = totalIssuesBasedOnFixLevel[automaticFixLevel];
|
||||
|
||||
_cliTools().logger.log(`\nAttempting to fix ${_chalk().default.bold(issuesCount.toString())} issue${issuesCount > 1 ? 's' : ''}...`);
|
||||
|
||||
for (const category of healthchecks) {
|
||||
const healthchecksToRun = category.healthchecks.filter(healthcheck => {
|
||||
if (automaticFixLevel === AUTOMATIC_FIX_LEVELS.ALL_ISSUES) {
|
||||
return healthcheck.needsToBeFixed;
|
||||
}
|
||||
|
||||
if (automaticFixLevel === AUTOMATIC_FIX_LEVELS.ERRORS) {
|
||||
return healthcheck.needsToBeFixed && healthcheck.type === _healthchecks.HEALTHCHECK_TYPES.ERROR;
|
||||
}
|
||||
|
||||
if (automaticFixLevel === AUTOMATIC_FIX_LEVELS.WARNINGS) {
|
||||
return healthcheck.needsToBeFixed && healthcheck.type === _healthchecks.HEALTHCHECK_TYPES.WARNING;
|
||||
}
|
||||
|
||||
return;
|
||||
});
|
||||
|
||||
if (!healthchecksToRun.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
_cliTools().logger.log(`\n${_chalk().default.dim(category.label)}`);
|
||||
|
||||
for (const healthcheckToRun of healthchecksToRun) {
|
||||
const spinner = (0, _ora().default)({
|
||||
prefixText: '',
|
||||
text: healthcheckToRun.label
|
||||
}).start();
|
||||
|
||||
try {
|
||||
await healthcheckToRun.runAutomaticFix({
|
||||
loader: spinner,
|
||||
environmentInfo
|
||||
});
|
||||
} catch (error) {// TODO: log the error in a meaningful way
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=runAutomaticFix.js.map
|
1
node_modules/@react-native-community/cli/build/commands/doctor/types.js
generated
vendored
Normal file
1
node_modules/@react-native-community/cli/build/commands/doctor/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
"use strict";
|
23
node_modules/@react-native-community/cli/build/commands/doctor/versionRanges.js
generated
vendored
Normal file
23
node_modules/@react-native-community/cli/build/commands/doctor/versionRanges.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _default = {
|
||||
// Common
|
||||
NODE_JS: '>= 8.3',
|
||||
YARN: '>= 1.10.x',
|
||||
NPM: '>= 4.x',
|
||||
WATCHMAN: '4.x',
|
||||
PYTHON: '>= 2.x < 3',
|
||||
JAVA: '>= 8',
|
||||
// Android
|
||||
ANDROID_SDK: '>= 26.x',
|
||||
ANDROID_NDK: '>= 19.x',
|
||||
// iOS
|
||||
XCODE: '>= 10.x'
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=versionRanges.js.map
|
49
node_modules/@react-native-community/cli/build/commands/index.js
generated
vendored
Normal file
49
node_modules/@react-native-community/cli/build/commands/index.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.detachedCommands = exports.projectCommands = void 0;
|
||||
|
||||
var _start = _interopRequireDefault(require("./start/start"));
|
||||
|
||||
var _bundle = _interopRequireDefault(require("./bundle/bundle"));
|
||||
|
||||
var _ramBundle = _interopRequireDefault(require("./bundle/ramBundle"));
|
||||
|
||||
var _link = _interopRequireDefault(require("./link/link"));
|
||||
|
||||
var _unlink = _interopRequireDefault(require("./link/unlink"));
|
||||
|
||||
var _install = _interopRequireDefault(require("./install/install"));
|
||||
|
||||
var _uninstall = _interopRequireDefault(require("./install/uninstall"));
|
||||
|
||||
var _upgrade = _interopRequireDefault(require("./upgrade/upgrade"));
|
||||
|
||||
var _info = _interopRequireDefault(require("./info/info"));
|
||||
|
||||
var _config = _interopRequireDefault(require("./config/config"));
|
||||
|
||||
var _init = _interopRequireDefault(require("./init"));
|
||||
|
||||
var _doctor = _interopRequireDefault(require("./doctor"));
|
||||
|
||||
function _cliHermes() {
|
||||
const data = _interopRequireDefault(require("@react-native-community/cli-hermes"));
|
||||
|
||||
_cliHermes = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const projectCommands = [_start.default, _bundle.default, _ramBundle.default, _link.default, _unlink.default, _install.default, _uninstall.default, _upgrade.default, _info.default, _config.default, _doctor.default, _cliHermes().default];
|
||||
exports.projectCommands = projectCommands;
|
||||
const detachedCommands = [_init.default, _doctor.default];
|
||||
exports.detachedCommands = detachedCommands;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
52
node_modules/@react-native-community/cli/build/commands/info/info.js
generated
vendored
Normal file
52
node_modules/@react-native-community/cli/build/commands/info/info.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _envinfo = _interopRequireDefault(require("../../tools/envinfo"));
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _releaseChecker = _interopRequireDefault(require("../../tools/releaseChecker"));
|
||||
|
||||
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.
|
||||
*/
|
||||
// @ts-ignore untyped
|
||||
const info = async function getInfo(_argv, ctx) {
|
||||
try {
|
||||
_cliTools().logger.info('Fetching system and libraries information...');
|
||||
|
||||
const output = await (0, _envinfo.default)(false);
|
||||
|
||||
_cliTools().logger.log(output);
|
||||
} catch (err) {
|
||||
_cliTools().logger.error(`Unable to print environment info.\n${err}`);
|
||||
} finally {
|
||||
await (0, _releaseChecker.default)(ctx.root);
|
||||
}
|
||||
};
|
||||
|
||||
var _default = {
|
||||
name: 'info',
|
||||
description: 'Get relevant version info about OS, toolchain and libraries',
|
||||
func: info
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=info.js.map
|
30
node_modules/@react-native-community/cli/build/commands/init/banner.js
generated
vendored
Normal file
30
node_modules/@react-native-community/cli/build/commands/init/banner.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const reactLogoArray = [' ', ' ###### ###### ', ' ### #### #### ### ', ' ## ### ### ## ', ' ## #### ## ', ' ## #### ## ', ' ## ## ## ## ', ' ## ### ### ## ', ' ## ######################## ## ', ' ###### ### ### ###### ', ' ### ## ## ## ## ### ', ' ### ## ### #### ### ## ### ', ' ## #### ######## #### ## ', ' ## ### ########## ### ## ', ' ## #### ######## #### ## ', ' ### ## ### #### ### ## ### ', ' ### ## ## ## ## ### ', ' ###### ### ### ###### ', ' ## ######################## ## ', ' ## ### ### ## ', ' ## ## ## ## ', ' ## #### ## ', ' ## #### ## ', ' ## ### ### ## ', ' ### #### #### ### ', ' ###### ###### ', ' '];
|
||||
const welcomeMessage = ' Welcome to React Native! ';
|
||||
const learnOnceMessage = ' Learn once, write anywhere ';
|
||||
var _default = `${_chalk().default.blue(reactLogoArray.join('\n'))}
|
||||
|
||||
${_chalk().default.blue.bold(welcomeMessage)}
|
||||
${_chalk().default.dim(learnOnceMessage)}
|
||||
`;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=banner.js.map
|
118
node_modules/@react-native-community/cli/build/commands/init/editTemplate.js
generated
vendored
Normal file
118
node_modules/@react-native-community/cli/build/commands/init/editTemplate.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.changePlaceholderInTemplate = changePlaceholderInTemplate;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var _walk = _interopRequireDefault(require("../../tools/walk"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
TODO: This is a default placeholder for title in react-native template.
|
||||
We should get rid of this once custom templates adapt `placeholderTitle` in their configurations.
|
||||
*/
|
||||
const DEFAULT_TITLE_PLACEHOLDER = 'Hello App Display Name';
|
||||
|
||||
function replaceNameInUTF8File(filePath, projectName, templateName) {
|
||||
_cliTools().logger.debug(`Replacing in ${filePath}`);
|
||||
|
||||
const fileContent = _fs().default.readFileSync(filePath, 'utf8');
|
||||
|
||||
const replacedFileContent = fileContent.replace(new RegExp(templateName, 'g'), projectName).replace(new RegExp(templateName.toLowerCase(), 'g'), projectName.toLowerCase());
|
||||
|
||||
if (fileContent !== replacedFileContent) {
|
||||
_fs().default.writeFileSync(filePath, replacedFileContent, 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
function renameFile(filePath, oldName, newName) {
|
||||
const newFileName = _path().default.join(_path().default.dirname(filePath), _path().default.basename(filePath).replace(new RegExp(oldName, 'g'), newName));
|
||||
|
||||
_cliTools().logger.debug(`Renaming ${filePath} -> file:${newFileName}`);
|
||||
|
||||
_fs().default.renameSync(filePath, newFileName);
|
||||
}
|
||||
|
||||
function shouldRenameFile(filePath, nameToReplace) {
|
||||
return _path().default.basename(filePath).includes(nameToReplace);
|
||||
}
|
||||
|
||||
function shouldIgnoreFile(filePath) {
|
||||
return filePath.match(/node_modules|yarn.lock|package-lock.json/g);
|
||||
}
|
||||
|
||||
const UNDERSCORED_DOTFILES = ['buckconfig', 'eslintrc.js', 'flowconfig', 'gitattributes', 'gitignore', 'prettierrc.js', 'watchmanconfig'];
|
||||
|
||||
function processDotfiles(filePath) {
|
||||
const dotfile = UNDERSCORED_DOTFILES.find(e => filePath.includes(`_${e}`));
|
||||
|
||||
if (dotfile === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
renameFile(filePath, `_${dotfile}`, `.${dotfile}`);
|
||||
}
|
||||
|
||||
function changePlaceholderInTemplate({
|
||||
projectName,
|
||||
placeholderName,
|
||||
placeholderTitle = DEFAULT_TITLE_PLACEHOLDER,
|
||||
projectTitle = projectName
|
||||
}) {
|
||||
_cliTools().logger.debug(`Changing ${placeholderName} for ${projectName} in template`);
|
||||
|
||||
(0, _walk.default)(process.cwd()).reverse().forEach(filePath => {
|
||||
if (shouldIgnoreFile(filePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_fs().default.statSync(filePath).isDirectory()) {
|
||||
replaceNameInUTF8File(filePath, projectName, placeholderName);
|
||||
replaceNameInUTF8File(filePath, projectTitle, placeholderTitle);
|
||||
}
|
||||
|
||||
if (shouldRenameFile(filePath, placeholderName)) {
|
||||
renameFile(filePath, placeholderName, projectName);
|
||||
}
|
||||
|
||||
if (shouldRenameFile(filePath, placeholderName.toLowerCase())) {
|
||||
renameFile(filePath, placeholderName.toLowerCase(), projectName.toLowerCase());
|
||||
}
|
||||
|
||||
processDotfiles(filePath);
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=editTemplate.js.map
|
17
node_modules/@react-native-community/cli/build/commands/init/errors/DirectoryAlreadyExistsError.js
generated
vendored
Normal file
17
node_modules/@react-native-community/cli/build/commands/init/errors/DirectoryAlreadyExistsError.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class DirectoryAlreadyExistsError extends Error {
|
||||
constructor(directory) {
|
||||
super(`Cannot initialize new project because directory "${directory}" already exists.`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = DirectoryAlreadyExistsError;
|
||||
|
||||
//# sourceMappingURL=DirectoryAlreadyExistsError.js.map
|
17
node_modules/@react-native-community/cli/build/commands/init/errors/HelloWorldError.js
generated
vendored
Normal file
17
node_modules/@react-native-community/cli/build/commands/init/errors/HelloWorldError.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class HelloWorldError extends Error {
|
||||
constructor() {
|
||||
super('Project name shouldn\'t contain "HelloWorld" name in it, because it is CLI\'s default placeholder name.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = HelloWorldError;
|
||||
|
||||
//# sourceMappingURL=HelloWorldError.js.map
|
17
node_modules/@react-native-community/cli/build/commands/init/errors/InvalidNameError.js
generated
vendored
Normal file
17
node_modules/@react-native-community/cli/build/commands/init/errors/InvalidNameError.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class InvalidNameError extends Error {
|
||||
constructor(name) {
|
||||
super(`"${name}" is not a valid name for a project. Please use a valid identifier name (alphanumeric).`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = InvalidNameError;
|
||||
|
||||
//# sourceMappingURL=InvalidNameError.js.map
|
17
node_modules/@react-native-community/cli/build/commands/init/errors/ReservedNameError.js
generated
vendored
Normal file
17
node_modules/@react-native-community/cli/build/commands/init/errors/ReservedNameError.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
class ReservedNameError extends Error {
|
||||
constructor() {
|
||||
super('Not a valid name for a project. Please do not use the reserved word "React".');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ReservedNameError;
|
||||
|
||||
//# sourceMappingURL=ReservedNameError.js.map
|
39
node_modules/@react-native-community/cli/build/commands/init/index.js
generated
vendored
Normal file
39
node_modules/@react-native-community/cli/build/commands/init/index.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _init = _interopRequireDefault(require("./init"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = {
|
||||
func: _init.default,
|
||||
detached: true,
|
||||
name: 'init <projectName>',
|
||||
description: 'Initialize a new React Native project named <projectName> in a directory of the same name.',
|
||||
options: [{
|
||||
name: '--version [string]',
|
||||
description: 'Shortcut for `--template react-native@version`'
|
||||
}, {
|
||||
name: '--template [string]',
|
||||
description: 'Uses a custom template. Valid arguments are: npm package, absolute directory prefixed with `file://`, Git repository or a tarball'
|
||||
}, {
|
||||
name: '--npm',
|
||||
description: 'Forces using npm for initialization'
|
||||
}, {
|
||||
name: '--directory [string]',
|
||||
description: 'Uses a custom directory instead of `<projectName>`.'
|
||||
}, {
|
||||
name: '--title [string]',
|
||||
description: 'Uses a custom app title name for application'
|
||||
}, {
|
||||
name: '--skip-install',
|
||||
description: 'Skips dependencies installation step'
|
||||
}]
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
257
node_modules/@react-native-community/cli/build/commands/init/init.js
generated
vendored
Normal file
257
node_modules/@react-native-community/cli/build/commands/init/init.js
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _os() {
|
||||
const data = _interopRequireDefault(require("os"));
|
||||
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fsExtra() {
|
||||
const data = _interopRequireDefault(require("fs-extra"));
|
||||
|
||||
_fsExtra = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _minimist() {
|
||||
const data = _interopRequireDefault(require("minimist"));
|
||||
|
||||
_minimist = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _mkdirp() {
|
||||
const data = _interopRequireDefault(require("mkdirp"));
|
||||
|
||||
_mkdirp = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _validate = require("./validate");
|
||||
|
||||
var _DirectoryAlreadyExistsError = _interopRequireDefault(require("./errors/DirectoryAlreadyExistsError"));
|
||||
|
||||
var _printRunInstructions = _interopRequireDefault(require("./printRunInstructions"));
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _template = require("./template");
|
||||
|
||||
var _editTemplate = require("./editTemplate");
|
||||
|
||||
var PackageManager = _interopRequireWildcard(require("../../tools/packageManager"));
|
||||
|
||||
var _installPods = _interopRequireDefault(require("../../tools/installPods"));
|
||||
|
||||
var _templateName = require("./templateName");
|
||||
|
||||
var _banner = _interopRequireDefault(require("./banner"));
|
||||
|
||||
var _loader = require("../../tools/loader");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const DEFAULT_VERSION = 'latest';
|
||||
|
||||
function doesDirectoryExist(dir) {
|
||||
return _fsExtra().default.existsSync(dir);
|
||||
}
|
||||
|
||||
async function setProjectDirectory(directory) {
|
||||
if (doesDirectoryExist(directory)) {
|
||||
throw new _DirectoryAlreadyExistsError.default(directory);
|
||||
}
|
||||
|
||||
try {
|
||||
_mkdirp().default.sync(directory);
|
||||
|
||||
process.chdir(directory);
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)('Error occurred while trying to create project directory.', error);
|
||||
}
|
||||
|
||||
return process.cwd();
|
||||
}
|
||||
|
||||
function adjustNameIfUrl(name, cwd) {
|
||||
// We use package manager to infer the name of the template module for us.
|
||||
// That's why we get it from temporary package.json, where the name is the
|
||||
// first and only dependency (hence 0).
|
||||
if (name.match(/https?:/)) {
|
||||
name = Object.keys(JSON.parse(_fsExtra().default.readFileSync(_path().default.join(cwd, './package.json'), 'utf8')).dependencies)[0];
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
async function createFromTemplate({
|
||||
projectName,
|
||||
templateName,
|
||||
npm,
|
||||
directory,
|
||||
projectTitle,
|
||||
skipInstall
|
||||
}) {
|
||||
_cliTools().logger.debug('Initializing new project');
|
||||
|
||||
_cliTools().logger.log(_banner.default);
|
||||
|
||||
const projectDirectory = await setProjectDirectory(directory);
|
||||
const Loader = (0, _loader.getLoader)();
|
||||
const loader = new Loader({
|
||||
text: 'Downloading template'
|
||||
});
|
||||
|
||||
const templateSourceDir = _fsExtra().default.mkdtempSync(_path().default.join(_os().default.tmpdir(), 'rncli-init-template-'));
|
||||
|
||||
try {
|
||||
loader.start();
|
||||
let {
|
||||
uri,
|
||||
name
|
||||
} = await (0, _templateName.processTemplateName)(templateName);
|
||||
await (0, _template.installTemplatePackage)(uri, templateSourceDir, npm);
|
||||
loader.succeed();
|
||||
loader.start('Copying template');
|
||||
name = adjustNameIfUrl(name, templateSourceDir);
|
||||
const templateConfig = (0, _template.getTemplateConfig)(name, templateSourceDir);
|
||||
await (0, _template.copyTemplate)(name, templateConfig.templateDir, templateSourceDir);
|
||||
loader.succeed();
|
||||
loader.start('Processing template');
|
||||
(0, _editTemplate.changePlaceholderInTemplate)({
|
||||
projectName,
|
||||
projectTitle,
|
||||
placeholderName: templateConfig.placeholderName,
|
||||
placeholderTitle: templateConfig.titlePlaceholder
|
||||
});
|
||||
loader.succeed();
|
||||
const {
|
||||
postInitScript
|
||||
} = templateConfig;
|
||||
|
||||
if (postInitScript) {
|
||||
// Leaving trailing space because there may be stdout from the script
|
||||
loader.start('Executing post init script ');
|
||||
await (0, _template.executePostInitScript)(name, postInitScript, templateSourceDir);
|
||||
loader.succeed();
|
||||
}
|
||||
|
||||
if (!skipInstall) {
|
||||
await installDependencies({
|
||||
projectName,
|
||||
npm,
|
||||
loader,
|
||||
root: projectDirectory
|
||||
});
|
||||
} else {
|
||||
loader.succeed('Dependencies installation skipped');
|
||||
}
|
||||
} catch (e) {
|
||||
loader.fail();
|
||||
throw new Error(e);
|
||||
} finally {
|
||||
_fsExtra().default.removeSync(templateSourceDir);
|
||||
}
|
||||
}
|
||||
|
||||
async function installDependencies({
|
||||
projectName,
|
||||
npm,
|
||||
loader,
|
||||
root
|
||||
}) {
|
||||
loader.start('Installing dependencies');
|
||||
await PackageManager.installAll({
|
||||
preferYarn: !npm,
|
||||
silent: true,
|
||||
root
|
||||
});
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
await (0, _installPods.default)({
|
||||
projectName,
|
||||
loader
|
||||
});
|
||||
}
|
||||
|
||||
loader.succeed();
|
||||
}
|
||||
|
||||
async function createProject(projectName, directory, version, options) {
|
||||
const templateName = options.template || `react-native@${version}`;
|
||||
return createFromTemplate({
|
||||
projectName,
|
||||
templateName,
|
||||
npm: options.npm,
|
||||
directory,
|
||||
projectTitle: options.title,
|
||||
skipInstall: options.skipInstall
|
||||
});
|
||||
}
|
||||
|
||||
var initialize = async function initialize([projectName], options) {
|
||||
const root = process.cwd();
|
||||
(0, _validate.validateProjectName)(projectName);
|
||||
/**
|
||||
* Commander is stripping `version` from options automatically.
|
||||
* We have to use `minimist` to take that directly from `process.argv`
|
||||
*/
|
||||
|
||||
const version = (0, _minimist().default)(process.argv).version || DEFAULT_VERSION;
|
||||
|
||||
const directoryName = _path().default.relative(root, options.directory || projectName);
|
||||
|
||||
try {
|
||||
await createProject(projectName, directoryName, version, options);
|
||||
|
||||
const projectFolder = _path().default.join(root, directoryName);
|
||||
|
||||
(0, _printRunInstructions.default)(projectFolder, projectName);
|
||||
} catch (e) {
|
||||
_cliTools().logger.error(e.message);
|
||||
}
|
||||
};
|
||||
|
||||
exports.default = initialize;
|
||||
|
||||
//# sourceMappingURL=init.js.map
|
164
node_modules/@react-native-community/cli/build/commands/init/initCompat.js
generated
vendored
Normal file
164
node_modules/@react-native-community/cli/build/commands/init/initCompat.js
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _minimist() {
|
||||
const data = _interopRequireDefault(require("minimist"));
|
||||
|
||||
_minimist = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _process() {
|
||||
const data = _interopRequireDefault(require("process"));
|
||||
|
||||
_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _printRunInstructions = _interopRequireDefault(require("./printRunInstructions"));
|
||||
|
||||
var _templates = require("../../tools/generator/templates");
|
||||
|
||||
var PackageManager = _interopRequireWildcard(require("../../tools/packageManager"));
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _installPods = _interopRequireDefault(require("../../tools/installPods"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates the template for a React Native project given the provided
|
||||
* parameters:
|
||||
* @param projectDir Templates will be copied here.
|
||||
* @param argsOrName Project name or full list of custom arguments
|
||||
* for the generator.
|
||||
* @param options Command line options passed from the react-native-cli directly.
|
||||
* E.g. `{ version: '0.43.0', template: 'navigation' }`
|
||||
*/
|
||||
async function initCompat(projectDir, argsOrName) {
|
||||
const args = Array.isArray(argsOrName) ? argsOrName // argsOrName was e.g. ['AwesomeApp', '--verbose']
|
||||
: [argsOrName].concat(_process().default.argv.slice(4)); // argsOrName was e.g. 'AwesomeApp'
|
||||
// args array is e.g. ['AwesomeApp', '--verbose', '--template', 'navigation']
|
||||
|
||||
if (!args || args.length === 0) {
|
||||
_cliTools().logger.error('react-native init requires a project name.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const newProjectName = args[0];
|
||||
const options = (0, _minimist().default)(args);
|
||||
|
||||
_cliTools().logger.info(`Setting up new React Native app in ${projectDir}`);
|
||||
|
||||
await generateProject(projectDir, newProjectName, options);
|
||||
}
|
||||
/**
|
||||
* Generates a new React Native project based on the template.
|
||||
* @param Absolute path at which the project folder should be created.
|
||||
* @param options Command line arguments parsed by minimist.
|
||||
*/
|
||||
|
||||
|
||||
async function generateProject(destinationRoot, newProjectName, options) {
|
||||
const pkgJson = require('react-native/package.json');
|
||||
|
||||
const reactVersion = pkgJson.peerDependencies.react;
|
||||
await (0, _templates.createProjectFromTemplate)(destinationRoot, newProjectName, options.template);
|
||||
|
||||
_cliTools().logger.info('Adding required dependencies');
|
||||
|
||||
await PackageManager.install([`react@${reactVersion}`], {
|
||||
root: destinationRoot
|
||||
});
|
||||
|
||||
_cliTools().logger.info('Adding required dev dependencies');
|
||||
|
||||
await PackageManager.installDev(['@babel/core', '@babel/runtime', '@react-native-community/eslint-config', 'eslint', 'jest', 'babel-jest', 'metro-react-native-babel-preset', `react-test-renderer@${reactVersion}`], {
|
||||
root: destinationRoot
|
||||
});
|
||||
addJestToPackageJson(destinationRoot);
|
||||
|
||||
if (_process().default.platform === 'darwin') {
|
||||
_cliTools().logger.info('Installing required CocoaPods dependencies');
|
||||
|
||||
await (0, _installPods.default)({
|
||||
projectName: newProjectName
|
||||
});
|
||||
}
|
||||
|
||||
(0, _printRunInstructions.default)(destinationRoot, newProjectName);
|
||||
}
|
||||
/**
|
||||
* Add Jest-related stuff to package.json, which was created by the react-native-cli.
|
||||
*/
|
||||
|
||||
|
||||
function addJestToPackageJson(destinationRoot) {
|
||||
const packageJSONPath = _path().default.join(destinationRoot, 'package.json');
|
||||
|
||||
const packageJSON = JSON.parse(_fs().default.readFileSync(packageJSONPath).toString());
|
||||
packageJSON.scripts.test = 'jest';
|
||||
packageJSON.scripts.lint = 'eslint .';
|
||||
packageJSON.jest = {
|
||||
preset: 'react-native'
|
||||
};
|
||||
|
||||
_fs().default.writeFileSync(packageJSONPath, `${JSON.stringify(packageJSON, null, 2)}\n`);
|
||||
}
|
||||
|
||||
var _default = initCompat;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=initCompat.js.map
|
86
node_modules/@react-native-community/cli/build/commands/init/printRunInstructions.js
generated
vendored
Normal file
86
node_modules/@react-native-community/cli/build/commands/init/printRunInstructions.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
"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 _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 _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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
function printRunInstructions(projectDir, projectName) {
|
||||
const iosProjectDir = _path().default.resolve(projectDir, 'ios');
|
||||
|
||||
const iosPodsFile = _path().default.resolve(iosProjectDir, `${projectName}.xcworkspace`);
|
||||
|
||||
const isUsingPods = _fs().default.existsSync(iosPodsFile);
|
||||
|
||||
const relativeXcodeProjectPath = _path().default.relative('..', isUsingPods ? iosPodsFile : _path().default.resolve(iosProjectDir, `${projectName}.xcodeproj`));
|
||||
|
||||
_cliTools().logger.log(`
|
||||
${_chalk().default.cyan(`Run instructions for ${_chalk().default.bold('iOS')}`)}:
|
||||
• cd "${projectDir}" && npx react-native run-ios
|
||||
${_chalk().default.dim('- or -')}
|
||||
• Open ${relativeXcodeProjectPath} in Xcode or run "xed -b ios"
|
||||
• Hit the Run button
|
||||
|
||||
${_chalk().default.green(`Run instructions for ${_chalk().default.bold('Android')}`)}:
|
||||
• Have an Android emulator running (quickest way to get started), or a device connected.
|
||||
• cd "${projectDir}" && npx react-native run-android
|
||||
|
||||
${_chalk().default.magenta(`Run instructions for ${_chalk().default.bold('Windows')} and ${_chalk().default.bold('macOS')}`)}:
|
||||
• See ${_chalk().default.underline('https://aka.ms/ReactNative')} for the latest up-to-date instructions.
|
||||
`);
|
||||
}
|
||||
|
||||
var _default = printRunInstructions;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=printRunInstructions.js.map
|
123
node_modules/@react-native-community/cli/build/commands/init/template.js
generated
vendored
Normal file
123
node_modules/@react-native-community/cli/build/commands/init/template.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.installTemplatePackage = installTemplatePackage;
|
||||
exports.getTemplateConfig = getTemplateConfig;
|
||||
exports.copyTemplate = copyTemplate;
|
||||
exports.executePostInitScript = executePostInitScript;
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = 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;
|
||||
}
|
||||
|
||||
var PackageManager = _interopRequireWildcard(require("../../tools/packageManager"));
|
||||
|
||||
var _copyFiles = _interopRequireDefault(require("../../tools/copyFiles"));
|
||||
|
||||
var _replacePathSepForRegex = _interopRequireDefault(require("../../tools/replacePathSepForRegex"));
|
||||
|
||||
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 _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
async function installTemplatePackage(templateName, root, npm) {
|
||||
_cliTools().logger.debug(`Installing template from ${templateName}`);
|
||||
|
||||
await PackageManager.init({
|
||||
preferYarn: !npm,
|
||||
silent: true,
|
||||
root
|
||||
});
|
||||
return PackageManager.install([templateName], {
|
||||
preferYarn: !npm,
|
||||
silent: true,
|
||||
root
|
||||
});
|
||||
}
|
||||
|
||||
function getTemplateConfig(templateName, templateSourceDir) {
|
||||
const configFilePath = _path().default.resolve(templateSourceDir, 'node_modules', templateName, 'template.config.js');
|
||||
|
||||
_cliTools().logger.debug(`Getting config from ${configFilePath}`);
|
||||
|
||||
if (!_fs().default.existsSync(configFilePath)) {
|
||||
throw new (_cliTools().CLIError)(`Couldn't find the "${configFilePath} file inside "${templateName}" template. Please make sure the template is valid.
|
||||
Read more: ${_chalk().default.underline.dim('https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template')}`);
|
||||
}
|
||||
|
||||
return require(configFilePath);
|
||||
}
|
||||
|
||||
async function copyTemplate(templateName, templateDir, templateSourceDir) {
|
||||
const templatePath = _path().default.resolve(templateSourceDir, 'node_modules', templateName, templateDir);
|
||||
|
||||
_cliTools().logger.debug(`Copying template from ${templatePath}`);
|
||||
|
||||
let regexStr = _path().default.resolve(templatePath, 'node_modules');
|
||||
|
||||
await (0, _copyFiles.default)(templatePath, process.cwd(), {
|
||||
exclude: [new RegExp((0, _replacePathSepForRegex.default)(regexStr))]
|
||||
});
|
||||
}
|
||||
|
||||
function executePostInitScript(templateName, postInitScript, templateSourceDir) {
|
||||
const scriptPath = _path().default.resolve(templateSourceDir, 'node_modules', templateName, postInitScript);
|
||||
|
||||
_cliTools().logger.debug(`Executing post init script located ${scriptPath}`);
|
||||
|
||||
return (0, _execa().default)(scriptPath, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=template.js.map
|
140
node_modules/@react-native-community/cli/build/commands/init/templateName.js
generated
vendored
Normal file
140
node_modules/@react-native-community/cli/build/commands/init/templateName.js
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.processTemplateName = processTemplateName;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _url() {
|
||||
const data = require("url");
|
||||
|
||||
_url = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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 }; }
|
||||
|
||||
const FILE_PROTOCOL = /file:/;
|
||||
const TARBALL = /\.tgz$/;
|
||||
const VERSION_POSTFIX = /(.*)(-\d+\.\d+\.\d+)/;
|
||||
const VERSIONED_PACKAGE = /(@?.+)(@)(.+)/;
|
||||
|
||||
function handleFileProtocol(filePath) {
|
||||
let uri = new (_url().URL)(filePath).pathname;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// On Windows, the pathname has an extra / at the start, so remove that
|
||||
uri = uri.substring(1);
|
||||
}
|
||||
|
||||
if (!_fs().default.existsSync(uri)) {
|
||||
throw new (_cliTools().CLIError)(`Failed to retrieve template name. The specified template directory path "${uri}" does not exist or is invalid.`);
|
||||
}
|
||||
|
||||
const packageJsonPath = _path().default.join(uri, 'package.json');
|
||||
|
||||
let packageJson;
|
||||
|
||||
try {
|
||||
packageJson = JSON.parse(_fs().default.readFileSync(packageJsonPath, {
|
||||
encoding: 'utf8'
|
||||
}));
|
||||
} catch (_unused) {
|
||||
throw new (_cliTools().CLIError)('Failed to retrieve template name. We expect the template directory to include "package.json" file, but it was not found.');
|
||||
}
|
||||
|
||||
if (!packageJson || !packageJson.name) {
|
||||
throw new (_cliTools().CLIError)(`Failed to retrieve template name. We expect the "package.json" of the template to include the "name" property, but we found "${packageJson ? packageJson.name : 'undefined'}" which is invalid.`);
|
||||
}
|
||||
|
||||
return {
|
||||
uri,
|
||||
name: packageJson.name
|
||||
};
|
||||
}
|
||||
|
||||
function handleTarball(filePath) {
|
||||
if (!_fs().default.existsSync(filePath)) {
|
||||
throw new (_cliTools().CLIError)(`Failed to retrieve tarball name. The specified tarball path "${filePath}" does not exist or is invalid.`);
|
||||
}
|
||||
|
||||
const nameWithVersion = _path().default.parse(_path().default.basename(filePath)).name;
|
||||
|
||||
const tarballVersionMatch = nameWithVersion.match(VERSION_POSTFIX);
|
||||
|
||||
if (!tarballVersionMatch) {
|
||||
throw new (_cliTools().CLIError)(`Failed to retrieve tarball name. We expect the tarball to include package name and version, e.g.: "template-name-1.2.3-rc.0.tgz", but received: "${nameWithVersion}".`);
|
||||
}
|
||||
|
||||
return {
|
||||
uri: filePath,
|
||||
name: tarballVersionMatch[1]
|
||||
};
|
||||
}
|
||||
|
||||
function handleVersionedPackage(versionedPackage) {
|
||||
const versionedPackageMatch = versionedPackage.match(VERSIONED_PACKAGE);
|
||||
|
||||
if (!versionedPackageMatch) {
|
||||
throw new (_cliTools().CLIError)(`Failed to retrieve package name. We expect the package to include name and version, e.g.: "template-name@1.2.3-rc.0", but received: "${versionedPackage}".`);
|
||||
}
|
||||
|
||||
return {
|
||||
uri: versionedPackage,
|
||||
name: versionedPackageMatch[1]
|
||||
};
|
||||
}
|
||||
|
||||
function processTemplateName(templateName) {
|
||||
if (templateName.match(TARBALL)) {
|
||||
return handleTarball(templateName);
|
||||
}
|
||||
|
||||
if (templateName.match(FILE_PROTOCOL)) {
|
||||
return handleFileProtocol(templateName);
|
||||
}
|
||||
|
||||
if (templateName.match(VERSIONED_PACKAGE)) {
|
||||
return handleVersionedPackage(templateName);
|
||||
}
|
||||
|
||||
return {
|
||||
uri: templateName,
|
||||
name: templateName
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=templateName.js.map
|
37
node_modules/@react-native-community/cli/build/commands/init/validate.js
generated
vendored
Normal file
37
node_modules/@react-native-community/cli/build/commands/init/validate.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validateProjectName = validateProjectName;
|
||||
|
||||
var _InvalidNameError = _interopRequireDefault(require("./errors/InvalidNameError"));
|
||||
|
||||
var _ReservedNameError = _interopRequireDefault(require("./errors/ReservedNameError"));
|
||||
|
||||
var _HelloWorldError = _interopRequireDefault(require("./errors/HelloWorldError"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const NAME_REGEX = /^[$A-Z_][0-9A-Z_$]*$/i; // ref: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
|
||||
|
||||
const javaKeywords = ['abstract', 'continue', 'for', 'new', 'switch', 'assert', 'default', 'goto', 'package', 'synchronized', 'boolean', 'do', 'if', 'private', 'this', 'break', 'double', 'implements', 'protected', 'throw', 'byte', 'else', 'import', 'public', 'throws', 'case', 'enum', 'instanceof', 'return', 'transient', 'catch', 'extends', 'int', 'short', 'try', 'char', 'final', 'interface', 'static', 'void', 'class', 'finally', 'long', 'strictfp', 'volatile', 'const', 'float', 'native', 'super', 'while'];
|
||||
const reservedNames = ['react', 'react-native', ...javaKeywords];
|
||||
|
||||
function validateProjectName(name) {
|
||||
if (!String(name).match(NAME_REGEX)) {
|
||||
throw new _InvalidNameError.default(name);
|
||||
}
|
||||
|
||||
const lowerCaseName = name.toLowerCase();
|
||||
|
||||
if (reservedNames.includes(lowerCaseName)) {
|
||||
throw new _ReservedNameError.default();
|
||||
}
|
||||
|
||||
if (name.match(/helloworld/gi)) {
|
||||
throw new _HelloWorldError.default();
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=validate.js.map
|
64
node_modules/@react-native-community/cli/build/commands/install/install.js
generated
vendored
Normal file
64
node_modules/@react-native-community/cli/build/commands/install/install.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var PackageManager = _interopRequireWildcard(require("../../tools/packageManager"));
|
||||
|
||||
var _link = _interopRequireDefault(require("../link/link"));
|
||||
|
||||
var _config = _interopRequireDefault(require("../../tools/config"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
/**
|
||||
* 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 install(args, ctx) {
|
||||
const name = args[0];
|
||||
|
||||
_cliTools().logger.info(`Installing "${name}"...`);
|
||||
|
||||
await PackageManager.install([name], {
|
||||
root: ctx.root
|
||||
}); // Reload configuration to see newly installed dependency
|
||||
|
||||
const newConfig = (0, _config.default)();
|
||||
|
||||
_cliTools().logger.info(`Linking "${name}"...`);
|
||||
|
||||
await _link.default.func([name], newConfig, {
|
||||
platforms: undefined
|
||||
});
|
||||
|
||||
_cliTools().logger.success(`Successfully installed and linked "${name}"`);
|
||||
}
|
||||
|
||||
var _default = {
|
||||
func: install,
|
||||
description: 'install and link native dependencies',
|
||||
name: 'install <packageName>'
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=install.js.map
|
58
node_modules/@react-native-community/cli/build/commands/install/uninstall.js
generated
vendored
Normal file
58
node_modules/@react-native-community/cli/build/commands/install/uninstall.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var PackageManager = _interopRequireWildcard(require("../../tools/packageManager"));
|
||||
|
||||
var _unlink = _interopRequireDefault(require("../link/unlink"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
/**
|
||||
* 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 uninstall(args, ctx) {
|
||||
const name = args[0];
|
||||
|
||||
_cliTools().logger.info(`Unlinking "${name}"...`);
|
||||
|
||||
await _unlink.default.func([name], ctx, {});
|
||||
|
||||
_cliTools().logger.info(`Uninstalling "${name}"...`);
|
||||
|
||||
await PackageManager.uninstall([name], {
|
||||
root: ctx.root
|
||||
});
|
||||
|
||||
_cliTools().logger.success(`Successfully uninstalled and unlinked "${name}"`);
|
||||
}
|
||||
|
||||
var _default = {
|
||||
func: uninstall,
|
||||
description: 'uninstall and unlink native dependencies',
|
||||
name: 'uninstall <packageName>'
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=uninstall.js.map
|
16
node_modules/@react-native-community/cli/build/commands/link/getPlatformName.js
generated
vendored
Normal file
16
node_modules/@react-native-community/cli/build/commands/link/getPlatformName.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getPlatformName;
|
||||
const names = {
|
||||
ios: 'iOS',
|
||||
android: 'Android'
|
||||
};
|
||||
|
||||
function getPlatformName(name) {
|
||||
return names[name] || name;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getPlatformName.js.map
|
140
node_modules/@react-native-community/cli/build/commands/link/link.js
generated
vendored
Normal file
140
node_modules/@react-native-community/cli/build/commands/link/link.js
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.func = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _getPlatformName = _interopRequireDefault(require("./getPlatformName"));
|
||||
|
||||
var _linkDependency = _interopRequireDefault(require("./linkDependency"));
|
||||
|
||||
var _linkAssets = _interopRequireDefault(require("./linkAssets"));
|
||||
|
||||
var _linkAll = _interopRequireDefault(require("./linkAll"));
|
||||
|
||||
var _makeHook = _interopRequireDefault(require("./makeHook"));
|
||||
|
||||
var _printDeprecationWarning = _interopRequireDefault(require("./printDeprecationWarning"));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Updates project and links all dependencies to it.
|
||||
*
|
||||
* @param args If optional argument [packageName] is provided,
|
||||
* only that package is processed.
|
||||
*/
|
||||
async function link([rawPackageName], ctx, opts) {
|
||||
let platforms = ctx.platforms;
|
||||
let project = ctx.project;
|
||||
|
||||
if (opts.platforms) {
|
||||
// @ts-ignore
|
||||
platforms = (0, _lodash().pick)(platforms, opts.platforms);
|
||||
|
||||
_cliTools().logger.debug('Skipping selected platforms');
|
||||
}
|
||||
|
||||
_cliTools().logger.debug('Available platforms: ' + `${Object.keys(platforms).map(_getPlatformName.default).join(', ')}`);
|
||||
|
||||
if (rawPackageName === undefined) {
|
||||
_cliTools().logger.debug('No package name provided, will link all possible assets.');
|
||||
|
||||
return (0, _linkAll.default)(ctx, {
|
||||
linkDeps: opts.all,
|
||||
linkAssets: true
|
||||
});
|
||||
}
|
||||
|
||||
(0, _printDeprecationWarning.default)('react-native link [packageName]'); // Trim the version / tag out of the package name (eg. package@latest)
|
||||
|
||||
const packageName = rawPackageName.replace(/^(.+?)(@.+?)$/gi, '$1');
|
||||
|
||||
if (!Object.keys(ctx.dependencies).includes(packageName)) {
|
||||
throw new (_cliTools().CLIError)(`
|
||||
Unknown dependency. Make sure that the package you are trying to link is
|
||||
already installed in your "node_modules" and present in your "package.json" dependencies.
|
||||
`);
|
||||
}
|
||||
|
||||
const {
|
||||
[packageName]: dependency
|
||||
} = ctx.dependencies;
|
||||
|
||||
_cliTools().logger.debug(`Package to link: ${rawPackageName}`);
|
||||
|
||||
try {
|
||||
if (dependency.hooks.prelink) {
|
||||
await (0, _makeHook.default)(dependency.hooks.prelink)();
|
||||
}
|
||||
|
||||
await (0, _linkDependency.default)(platforms, project, dependency);
|
||||
|
||||
if (dependency.hooks.postlink) {
|
||||
await (0, _makeHook.default)(dependency.hooks.postlink)();
|
||||
}
|
||||
|
||||
await (0, _linkAssets.default)(platforms, project, dependency.assets);
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)(`Linking "${_chalk().default.bold(dependency.name)}" failed.`, error);
|
||||
}
|
||||
}
|
||||
|
||||
const func = link;
|
||||
exports.func = func;
|
||||
var _default = {
|
||||
func: link,
|
||||
description: 'links assets and optionally native modules',
|
||||
name: 'link [packageName]',
|
||||
options: [{
|
||||
name: '--platforms [list]',
|
||||
description: 'Scope linking to specified platforms',
|
||||
parse: val => val.toLowerCase().split(',')
|
||||
}, {
|
||||
name: '--all [boolean]',
|
||||
description: 'Link all native modules and assets',
|
||||
parse: val => val.toLowerCase().split(',')
|
||||
}]
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=link.js.map
|
106
node_modules/@react-native-community/cli/build/commands/link/linkAll.js
generated
vendored
Normal file
106
node_modules/@react-native-community/cli/build/commands/link/linkAll.js
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require("path"));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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 _linkAssets = _interopRequireDefault(require("./linkAssets"));
|
||||
|
||||
var _linkDependency = _interopRequireDefault(require("./linkDependency"));
|
||||
|
||||
var _makeHook = _interopRequireDefault(require("./makeHook"));
|
||||
|
||||
var _printDeprecationWarning = _interopRequireDefault(require("./printDeprecationWarning"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const dedupeAssets = assets => (0, _lodash().uniqBy)(assets, asset => path().basename(asset));
|
||||
|
||||
async function linkAll(config, options) {
|
||||
if (options.linkDeps) {
|
||||
(0, _printDeprecationWarning.default)('react-native link --all');
|
||||
|
||||
_cliTools().logger.debug('Linking all dependencies');
|
||||
|
||||
for (let key in config.dependencies) {
|
||||
const dependency = config.dependencies[key];
|
||||
|
||||
try {
|
||||
if (dependency.hooks.prelink) {
|
||||
await (0, _makeHook.default)(dependency.hooks.prelink)();
|
||||
}
|
||||
|
||||
await (0, _linkDependency.default)(config.platforms, config.project, dependency);
|
||||
|
||||
if (dependency.hooks.postlink) {
|
||||
await (0, _makeHook.default)(dependency.hooks.postlink)();
|
||||
}
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)(`Linking "${_chalk().default.bold(dependency.name)}" failed.`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options.linkAssets) {
|
||||
_cliTools().logger.debug('Linking all assets');
|
||||
|
||||
const projectAssets = config.assets;
|
||||
const assets = dedupeAssets(Object.keys(config.dependencies).reduce((acc, dependency) => acc.concat(config.dependencies[dependency].assets), projectAssets));
|
||||
|
||||
try {
|
||||
(0, _linkAssets.default)(config.platforms, config.project, assets);
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)('Linking assets failed.', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _default = linkAll;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=linkAll.js.map
|
48
node_modules/@react-native-community/cli/build/commands/link/linkAssets.js
generated
vendored
Normal file
48
node_modules/@react-native-community/cli/build/commands/link/linkAssets.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = linkAssets;
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function linkAssets(platforms, project, assets) {
|
||||
if ((0, _lodash().isEmpty)(assets)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(platforms || {}).forEach(platform => {
|
||||
const linkConfig = platforms[platform] && platforms[platform].linkConfig && platforms[platform].linkConfig();
|
||||
|
||||
if (!linkConfig || !linkConfig.copyAssets || !project[platform]) {
|
||||
return;
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`Linking assets to ${platform} project`);
|
||||
|
||||
linkConfig.copyAssets(assets, project[platform]);
|
||||
});
|
||||
|
||||
_cliTools().logger.success('Assets have been successfully linked to your project');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=linkAssets.js.map
|
69
node_modules/@react-native-community/cli/build/commands/link/linkDependency.js
generated
vendored
Normal file
69
node_modules/@react-native-community/cli/build/commands/link/linkDependency.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = linkDependency;
|
||||
|
||||
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 _pollParams = _interopRequireDefault(require("./pollParams"));
|
||||
|
||||
var _getPlatformName = _interopRequireDefault(require("./getPlatformName"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
async function linkDependency(platforms, project, dependency) {
|
||||
const params = await (0, _pollParams.default)(dependency.params);
|
||||
Object.keys(platforms || {}).forEach(platform => {
|
||||
const projectConfig = project[platform];
|
||||
const dependencyConfig = dependency.platforms[platform];
|
||||
|
||||
if (!projectConfig || !dependencyConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
name
|
||||
} = dependency;
|
||||
const linkConfig = platforms[platform] && platforms[platform].linkConfig && platforms[platform].linkConfig();
|
||||
|
||||
if (!linkConfig || !linkConfig.isInstalled || !linkConfig.register) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isInstalled = linkConfig.isInstalled(projectConfig, name, dependencyConfig);
|
||||
|
||||
if (isInstalled) {
|
||||
_cliTools().logger.info(`${(0, _getPlatformName.default)(platform)} module "${_chalk().default.bold(name)}" is already linked`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`Linking "${_chalk().default.bold(name)}" ${(0, _getPlatformName.default)(platform)} dependency`);
|
||||
|
||||
linkConfig.register(name, dependencyConfig, params, projectConfig);
|
||||
|
||||
_cliTools().logger.info(`${(0, _getPlatformName.default)(platform)} module "${_chalk().default.bold(dependency.name)}" has been successfully linked`);
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=linkDependency.js.map
|
30
node_modules/@react-native-community/cli/build/commands/link/makeHook.js
generated
vendored
Normal file
30
node_modules/@react-native-community/cli/build/commands/link/makeHook.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeHook;
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function makeHook(command) {
|
||||
return () => {
|
||||
const args = command.split(' ');
|
||||
const cmd = args.shift();
|
||||
return (0, _execa().default)(cmd, args, {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=makeHook.js.map
|
36
node_modules/@react-native-community/cli/build/commands/link/pollParams.js
generated
vendored
Normal file
36
node_modules/@react-native-community/cli/build/commands/link/pollParams.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _inquirer() {
|
||||
const data = require("inquirer");
|
||||
|
||||
_inquirer = 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.
|
||||
*/
|
||||
// @ts-ignore untyped
|
||||
var _default = questions => new Promise((resolve, reject) => {
|
||||
if (!questions) {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _inquirer().prompt)(questions).then(resolve, reject);
|
||||
});
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=pollParams.js.map
|
34
node_modules/@react-native-community/cli/build/commands/link/printDeprecationWarning.js
generated
vendored
Normal file
34
node_modules/@react-native-community/cli/build/commands/link/printDeprecationWarning.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = printDeprecationWarning;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function printDeprecationWarning(command) {
|
||||
_cliTools().logger.warn(`Calling ${_chalk().default.bold(command)} is deprecated in favor of autolinking. It will be removed in the next major release.\nAutolinking documentation: ${_chalk().default.dim.underline('https://github.com/react-native-community/cli/blob/master/docs/autolinking.md')}`);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=printDeprecationWarning.js.map
|
157
node_modules/@react-native-community/cli/build/commands/link/unlink.js
generated
vendored
Normal file
157
node_modules/@react-native-community/cli/build/commands/link/unlink.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _lodash() {
|
||||
const data = require("lodash");
|
||||
|
||||
_lodash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _getPlatformName = _interopRequireDefault(require("./getPlatformName"));
|
||||
|
||||
var _makeHook = _interopRequireDefault(require("./makeHook"));
|
||||
|
||||
var _printDeprecationWarning = _interopRequireDefault(require("./printDeprecationWarning"));
|
||||
|
||||
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 unlinkDependency = (platforms, project, dependency, packageName, otherDependencies) => {
|
||||
(0, _printDeprecationWarning.default)('react-native unlink [packageName]');
|
||||
Object.keys(platforms || {}).forEach(platform => {
|
||||
const projectConfig = project[platform];
|
||||
const dependencyConfig = dependency.platforms[platform];
|
||||
|
||||
if (!projectConfig || !dependencyConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
const linkConfig = platforms[platform] && platforms[platform].linkConfig && platforms[platform].linkConfig();
|
||||
|
||||
if (!linkConfig || !linkConfig.isInstalled || !linkConfig.unregister) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isInstalled = linkConfig.isInstalled(projectConfig, packageName, dependencyConfig);
|
||||
|
||||
if (!isInstalled) {
|
||||
_cliTools().logger.info(`${(0, _getPlatformName.default)(platform)} module "${packageName}" is not installed`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`Unlinking "${packageName}" ${(0, _getPlatformName.default)(platform)} dependency`);
|
||||
|
||||
linkConfig.unregister(packageName, dependencyConfig, projectConfig, otherDependencies);
|
||||
|
||||
_cliTools().logger.info(`${(0, _getPlatformName.default)(platform)} module "${dependency.name}" has been successfully unlinked`);
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Updates project and unlink specific dependency
|
||||
*
|
||||
* If optional argument [packageName] is provided, it's the only one
|
||||
* that's checked
|
||||
*/
|
||||
|
||||
|
||||
async function unlink(args, ctx, opts) {
|
||||
const packageName = args[0];
|
||||
let platforms = ctx.platforms;
|
||||
|
||||
if (opts.platforms) {
|
||||
// @ts-ignore
|
||||
platforms = (0, _lodash().pick)(platforms, opts.platforms);
|
||||
|
||||
_cliTools().logger.debug('Skipping selected platforms');
|
||||
}
|
||||
|
||||
_cliTools().logger.debug(`Available platforms: ${Object.keys(platforms).map(_getPlatformName.default).join(', ')}`);
|
||||
|
||||
const {
|
||||
[packageName]: dependency,
|
||||
...otherDependencies
|
||||
} = ctx.dependencies;
|
||||
|
||||
if (!dependency) {
|
||||
throw new (_cliTools().CLIError)(`
|
||||
Failed to unlink "${packageName}". It appears that the project is not linked yet.
|
||||
`);
|
||||
}
|
||||
|
||||
const dependencies = (0, _lodash().values)(otherDependencies);
|
||||
|
||||
try {
|
||||
if (dependency.hooks.preunlink) {
|
||||
await (0, _makeHook.default)(dependency.hooks.preunlink)();
|
||||
}
|
||||
|
||||
unlinkDependency(platforms, ctx.project, dependency, packageName, dependencies);
|
||||
|
||||
if (dependency.hooks.postunlink) {
|
||||
await (0, _makeHook.default)(dependency.hooks.postunlink)();
|
||||
}
|
||||
} catch (error) {
|
||||
throw new (_cliTools().CLIError)(`Something went wrong while unlinking. Reason ${error.message}`, error);
|
||||
} // @todo move all these to above try/catch
|
||||
// @todo it is possible we could be unlinking some project assets in case of duplicate
|
||||
|
||||
|
||||
const assets = (0, _lodash().difference)(dependency.assets, (0, _lodash().flatMap)(dependencies, d => d.assets));
|
||||
|
||||
if (assets.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(platforms || {}).forEach(platform => {
|
||||
const projectConfig = ctx.project[platform];
|
||||
const linkConfig = platforms[platform] && platforms[platform].linkConfig && platforms[platform].linkConfig();
|
||||
|
||||
if (!linkConfig || !linkConfig.unlinkAssets || !projectConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`Unlinking assets from ${platform} project`);
|
||||
|
||||
linkConfig.unlinkAssets(assets, projectConfig);
|
||||
});
|
||||
|
||||
_cliTools().logger.info(`${packageName} assets has been successfully unlinked from your project`);
|
||||
}
|
||||
|
||||
var _default = {
|
||||
func: unlink,
|
||||
description: 'unlink native dependency',
|
||||
name: 'unlink <packageName>',
|
||||
options: [{
|
||||
name: '--platforms [list]',
|
||||
description: 'Scope unlinking to specified platforms',
|
||||
parse: val => val.toLowerCase().split(',')
|
||||
}]
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=unlink.js.map
|
167
node_modules/@react-native-community/cli/build/commands/start/runServer.js
generated
vendored
Normal file
167
node_modules/@react-native-community/cli/build/commands/start/runServer.js
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _metro() {
|
||||
const data = _interopRequireDefault(require("metro"));
|
||||
|
||||
_metro = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _metroCore() {
|
||||
const data = require("metro-core");
|
||||
|
||||
_metroCore = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliServerApi() {
|
||||
const data = require("@react-native-community/cli-server-api");
|
||||
|
||||
_cliServerApi = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _loadMetroConfig = _interopRequireDefault(require("../../tools/loadMetroConfig"));
|
||||
|
||||
var _releaseChecker = _interopRequireDefault(require("../../tools/releaseChecker"));
|
||||
|
||||
var _watchMode = _interopRequireDefault(require("./watchMode"));
|
||||
|
||||
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.
|
||||
*/
|
||||
// @ts-ignore untyped metro
|
||||
// @ts-ignore untyped metro
|
||||
async function runServer(_argv, ctx, args) {
|
||||
let reportEvent;
|
||||
const terminal = new (_metroCore().Terminal)(process.stdout);
|
||||
const ReporterImpl = getReporterImpl(args.customLogReporterPath);
|
||||
const terminalReporter = new ReporterImpl(terminal);
|
||||
const reporter = {
|
||||
update(event) {
|
||||
terminalReporter.update(event);
|
||||
|
||||
if (reportEvent) {
|
||||
reportEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
const metroConfig = await (0, _loadMetroConfig.default)(ctx, {
|
||||
config: args.config,
|
||||
maxWorkers: args.maxWorkers,
|
||||
port: args.port,
|
||||
resetCache: args.resetCache,
|
||||
watchFolders: args.watchFolders,
|
||||
projectRoot: args.projectRoot,
|
||||
sourceExts: args.sourceExts,
|
||||
reporter
|
||||
});
|
||||
|
||||
if (args.assetPlugins) {
|
||||
metroConfig.transformer.assetPlugins = args.assetPlugins.map(plugin => require.resolve(plugin));
|
||||
}
|
||||
|
||||
const {
|
||||
middleware,
|
||||
attachToServer
|
||||
} = (0, _cliServerApi().createDevServerMiddleware)({
|
||||
host: args.host,
|
||||
port: metroConfig.server.port,
|
||||
watchFolders: metroConfig.watchFolders
|
||||
});
|
||||
middleware.use(_cliServerApi().indexPageMiddleware);
|
||||
const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;
|
||||
|
||||
metroConfig.server.enhanceMiddleware = (metroMiddleware, server) => {
|
||||
if (customEnhanceMiddleware) {
|
||||
metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);
|
||||
}
|
||||
|
||||
return middleware.use(metroMiddleware);
|
||||
};
|
||||
|
||||
const serverInstance = await _metro().default.runServer(metroConfig, {
|
||||
host: args.host,
|
||||
secure: args.https,
|
||||
secureCert: args.cert,
|
||||
secureKey: args.key,
|
||||
hmrEnabled: true
|
||||
});
|
||||
const {
|
||||
messageSocket,
|
||||
eventsSocket
|
||||
} = attachToServer(serverInstance);
|
||||
reportEvent = eventsSocket.reportEvent;
|
||||
|
||||
if (args.interactive) {
|
||||
(0, _watchMode.default)(messageSocket);
|
||||
} // In Node 8, the default keep-alive for an HTTP connection is 5 seconds. In
|
||||
// early versions of Node 8, this was implemented in a buggy way which caused
|
||||
// some HTTP responses (like those containing large JS bundles) to be
|
||||
// terminated early.
|
||||
//
|
||||
// As a workaround, arbitrarily increase the keep-alive from 5 to 30 seconds,
|
||||
// which should be enough to send even the largest of JS bundles.
|
||||
//
|
||||
// For more info: https://github.com/nodejs/node/issues/13391
|
||||
//
|
||||
|
||||
|
||||
serverInstance.keepAliveTimeout = 30000;
|
||||
await (0, _releaseChecker.default)(ctx.root);
|
||||
}
|
||||
|
||||
function getReporterImpl(customLogReporterPath) {
|
||||
if (customLogReporterPath === undefined) {
|
||||
return require('metro/src/lib/TerminalReporter');
|
||||
}
|
||||
|
||||
try {
|
||||
// First we let require resolve it, so we can require packages in node_modules
|
||||
// as expected. eg: require('my-package/reporter');
|
||||
return require(customLogReporterPath);
|
||||
} catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
} // If that doesn't work, then we next try relative to the cwd, eg:
|
||||
// require('./reporter');
|
||||
|
||||
|
||||
return require(_path().default.resolve(customLogReporterPath));
|
||||
}
|
||||
}
|
||||
|
||||
var _default = runServer;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=runServer.js.map
|
91
node_modules/@react-native-community/cli/build/commands/start/start.js
generated
vendored
Normal file
91
node_modules/@react-native-community/cli/build/commands/start/start.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
var _runServer = _interopRequireDefault(require("./runServer"));
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
var _default = {
|
||||
name: 'start',
|
||||
func: _runServer.default,
|
||||
description: 'starts the webserver',
|
||||
options: [{
|
||||
name: '--port [number]',
|
||||
parse: val => Number(val)
|
||||
}, {
|
||||
name: '--host [string]',
|
||||
default: ''
|
||||
}, {
|
||||
name: '--projectRoot [path]',
|
||||
description: 'Path to a custom project root',
|
||||
parse: val => _path().default.resolve(val)
|
||||
}, {
|
||||
name: '--watchFolders [list]',
|
||||
description: 'Specify any additional folders to be added to the watch list',
|
||||
parse: val => val.split(',').map(folder => _path().default.resolve(folder))
|
||||
}, {
|
||||
name: '--assetPlugins [list]',
|
||||
description: 'Specify any additional asset plugins to be used by the packager by full filepath',
|
||||
parse: val => val.split(',')
|
||||
}, {
|
||||
name: '--sourceExts [list]',
|
||||
description: 'Specify any additional source extensions to be used by the packager',
|
||||
parse: val => val.split(',')
|
||||
}, {
|
||||
name: '--max-workers [number]',
|
||||
description: 'Specifies the maximum number of workers the worker-pool ' + 'will spawn for transforming files. This defaults to the number of the ' + 'cores available on your machine.',
|
||||
parse: workers => Number(workers)
|
||||
}, {
|
||||
name: '--transformer [string]',
|
||||
description: 'Specify a custom transformer to be used'
|
||||
}, {
|
||||
name: '--reset-cache, --resetCache',
|
||||
description: 'Removes cached files'
|
||||
}, {
|
||||
name: '--custom-log-reporter-path, --customLogReporterPath [string]',
|
||||
description: 'Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter'
|
||||
}, {
|
||||
name: '--verbose',
|
||||
description: 'Enables logging'
|
||||
}, {
|
||||
name: '--https',
|
||||
description: 'Enables https connections to the server'
|
||||
}, {
|
||||
name: '--key [path]',
|
||||
description: 'Path to custom SSL key'
|
||||
}, {
|
||||
name: '--cert [path]',
|
||||
description: 'Path to custom SSL cert'
|
||||
}, {
|
||||
name: '--config [string]',
|
||||
description: 'Path to the CLI configuration file',
|
||||
parse: val => _path().default.resolve(val)
|
||||
}, {
|
||||
name: '--no-interactive',
|
||||
description: 'Disables interactive mode'
|
||||
}]
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=start.js.map
|
89
node_modules/@react-native-community/cli/build/commands/start/watchMode.js
generated
vendored
Normal file
89
node_modules/@react-native-community/cli/build/commands/start/watchMode.js
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _readline() {
|
||||
const data = _interopRequireDefault(require("readline"));
|
||||
|
||||
_readline = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _hookStdout = _interopRequireDefault(require("../../tools/hookStdout"));
|
||||
|
||||
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 }; }
|
||||
|
||||
function printWatchModeInstructions() {
|
||||
_cliTools().logger.log('\n\nTo reload the app press "r"\nTo open developer menu press "d"');
|
||||
}
|
||||
|
||||
function enableWatchMode(messageSocket) {
|
||||
// We need to set this to true to catch key presses individually.
|
||||
// As a result we have to implement our own method for exiting
|
||||
// and other commands (e.g. ctrl+c & ctrl+z)
|
||||
if (!process.stdin.setRawMode) {
|
||||
_cliTools().logger.debug('Watch mode is not supported in this environment');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_readline().default.emitKeypressEvents(process.stdin);
|
||||
|
||||
process.stdin.setRawMode(true); // We have no way of knowing when the dependency graph is done loading
|
||||
// except by hooking into stdout itself. We want to print instructions
|
||||
// right after its done loading.
|
||||
|
||||
const restore = (0, _hookStdout.default)(output => {
|
||||
if (output.includes('Learn once, write anywhere')) {
|
||||
printWatchModeInstructions();
|
||||
restore();
|
||||
}
|
||||
});
|
||||
process.stdin.on('keypress', (_key, data) => {
|
||||
const {
|
||||
ctrl,
|
||||
name
|
||||
} = data;
|
||||
|
||||
if (ctrl === true) {
|
||||
switch (name) {
|
||||
case 'c':
|
||||
process.exit();
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
process.emit('SIGTSTP');
|
||||
break;
|
||||
}
|
||||
} else if (name === 'r') {
|
||||
messageSocket.broadcast('reload', null);
|
||||
|
||||
_cliTools().logger.info('Reloading app...');
|
||||
} else if (name === 'd') {
|
||||
messageSocket.broadcast('devMenu', null);
|
||||
|
||||
_cliTools().logger.info('Opening developer menu...');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var _default = enableWatchMode;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=watchMode.js.map
|
396
node_modules/@react-native-community/cli/build/commands/upgrade/upgrade.js
generated
vendored
Normal file
396
node_modules/@react-native-community/cli/build/commands/upgrade/upgrade.js
generated
vendored
Normal file
@ -0,0 +1,396 @@
|
||||
"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 _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 _semver() {
|
||||
const data = _interopRequireDefault(require("semver"));
|
||||
|
||||
_semver = 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 PackageManager = _interopRequireWildcard(require("../../tools/packageManager"));
|
||||
|
||||
var _installPods = _interopRequireDefault(require("../../tools/installPods"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0-rc.3
|
||||
const webDiffUrl = 'https://react-native-community.github.io/upgrade-helper';
|
||||
const rawDiffUrl = 'https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs';
|
||||
|
||||
const isConnected = output => {
|
||||
// there is no reliable way of checking for internet connectivity, so we should just
|
||||
// read the output from npm (to check for connectivity errors) which is faster and relatively more reliable.
|
||||
return !output.includes('the host is inaccessible');
|
||||
};
|
||||
|
||||
const checkForErrors = output => {
|
||||
if (!output) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isConnected(output)) {
|
||||
throw new (_cliTools().CLIError)('Upgrade failed. You do not seem to have an internet connection.');
|
||||
}
|
||||
|
||||
if (output.includes('npm ERR')) {
|
||||
throw new (_cliTools().CLIError)(`Upgrade failed with the following errors:\n${output}`);
|
||||
}
|
||||
|
||||
if (output.includes('npm WARN')) {
|
||||
_cliTools().logger.warn(output);
|
||||
}
|
||||
};
|
||||
|
||||
const getLatestRNVersion = async () => {
|
||||
_cliTools().logger.info('No version passed. Fetching latest...');
|
||||
|
||||
const {
|
||||
stdout,
|
||||
stderr
|
||||
} = await (0, _execa().default)('npm', ['info', 'react-native', 'version']);
|
||||
checkForErrors(stderr);
|
||||
return stdout;
|
||||
};
|
||||
|
||||
const getRNPeerDeps = async version => {
|
||||
const {
|
||||
stdout,
|
||||
stderr
|
||||
} = await (0, _execa().default)('npm', ['info', `react-native@${version}`, 'peerDependencies', '--json']);
|
||||
checkForErrors(stderr);
|
||||
return JSON.parse(stdout);
|
||||
};
|
||||
|
||||
const getPatch = async (currentVersion, newVersion, config) => {
|
||||
let patch;
|
||||
|
||||
_cliTools().logger.info(`Fetching diff between v${currentVersion} and v${newVersion}...`);
|
||||
|
||||
try {
|
||||
const {
|
||||
data
|
||||
} = await (0, _cliTools().fetch)(`${rawDiffUrl}/${currentVersion}..${newVersion}.diff`);
|
||||
patch = data;
|
||||
} catch (error) {
|
||||
_cliTools().logger.error(error.message);
|
||||
|
||||
_cliTools().logger.error(`Failed to fetch diff for react-native@${newVersion}. Maybe it's not released yet?`);
|
||||
|
||||
_cliTools().logger.info(`For available releases to diff see: ${_chalk().default.underline.dim('https://github.com/react-native-community/rn-diff-purge#diff-table-full-table-here')}`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
let patchWithRenamedProjects = patch;
|
||||
Object.keys(config.project).forEach(platform => {
|
||||
if (!config.project[platform]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform === 'ios') {
|
||||
patchWithRenamedProjects = patchWithRenamedProjects.replace(new RegExp('RnDiffApp', 'g'), config.project[platform].projectName.replace('.xcodeproj', ''));
|
||||
} else if (platform === 'android') {
|
||||
patchWithRenamedProjects = patchWithRenamedProjects.replace(new RegExp('com\\.rndiffapp', 'g'), config.project[platform].packageName).replace(new RegExp('com\\.rndiffapp'.split('.').join('/'), 'g'), config.project[platform].packageName.split('.').join('/'));
|
||||
} else {
|
||||
_cliTools().logger.warn(`Unsupported platform: "${platform}". \`upgrade\` only supports iOS and Android.`);
|
||||
}
|
||||
});
|
||||
return patchWithRenamedProjects;
|
||||
};
|
||||
|
||||
const getVersionToUpgradeTo = async (argv, currentVersion, projectDir) => {
|
||||
const argVersion = argv[0];
|
||||
|
||||
const semverCoercedVersion = _semver().default.coerce(argVersion);
|
||||
|
||||
const newVersion = argVersion ? _semver().default.valid(argVersion) || (semverCoercedVersion ? semverCoercedVersion.version : null) : await getLatestRNVersion();
|
||||
|
||||
if (!newVersion) {
|
||||
_cliTools().logger.error(`Provided version "${argv[0]}" is not allowed. Please pass a valid semver version`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_semver().default.gt(currentVersion, newVersion)) {
|
||||
_cliTools().logger.error(`Trying to upgrade from newer version "${currentVersion}" to older "${newVersion}"`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_semver().default.eq(currentVersion, newVersion)) {
|
||||
const {
|
||||
dependencies: {
|
||||
'react-native': version
|
||||
}
|
||||
} = require(_path().default.join(projectDir, 'package.json'));
|
||||
|
||||
if (_semver().default.satisfies(newVersion, version)) {
|
||||
_cliTools().logger.warn(`Specified version "${newVersion}" is already installed in node_modules and it satisfies "${version}" semver range. No need to upgrade`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
_cliTools().logger.error(`Dependency mismatch. Specified version "${newVersion}" is already installed in node_modules and it doesn't satisfy "${version}" semver range of your "react-native" dependency. Please re-install your dependencies`);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return newVersion;
|
||||
};
|
||||
|
||||
const installDeps = async (root, newVersion) => {
|
||||
_cliTools().logger.info(`Installing "react-native@${newVersion}" and its peer dependencies...`);
|
||||
|
||||
const peerDeps = await getRNPeerDeps(newVersion);
|
||||
const deps = [`react-native@${newVersion}`, ...Object.keys(peerDeps).map(module => `${module}@${peerDeps[module]}`)];
|
||||
await PackageManager.install(deps, {
|
||||
silent: true,
|
||||
root
|
||||
});
|
||||
await (0, _execa().default)('git', ['add', 'package.json']);
|
||||
|
||||
try {
|
||||
await (0, _execa().default)('git', ['add', 'yarn.lock']);
|
||||
} catch (error) {// ignore
|
||||
}
|
||||
|
||||
try {
|
||||
await (0, _execa().default)('git', ['add', 'package-lock.json']);
|
||||
} catch (error) {// ignore
|
||||
}
|
||||
};
|
||||
|
||||
const installCocoaPodsDeps = async projectDir => {
|
||||
if (process.platform === 'darwin') {
|
||||
try {
|
||||
_cliTools().logger.info(`Installing CocoaPods dependencies ${_chalk().default.dim('(this may take a few minutes)')}`);
|
||||
|
||||
await (0, _installPods.default)({
|
||||
projectName: projectDir.split('/').pop() || ''
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.stderr) {
|
||||
_cliTools().logger.debug(`"pod install" or "pod repo update" failed. Error output:\n${error.stderr}`);
|
||||
}
|
||||
|
||||
_cliTools().logger.error('Installation of CocoaPods dependencies failed. Try to install them manually by running "pod install" in "ios" directory after finishing upgrade');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const applyPatch = async (currentVersion, newVersion, tmpPatchFile) => {
|
||||
const defaultExcludes = ['package.json'];
|
||||
let filesThatDontExist = [];
|
||||
let filesThatFailedToApply = [];
|
||||
const {
|
||||
stdout: relativePathFromRoot
|
||||
} = await (0, _execa().default)('git', ['rev-parse', '--show-prefix']);
|
||||
|
||||
try {
|
||||
try {
|
||||
const excludes = defaultExcludes.map(e => `--exclude=${_path().default.join(relativePathFromRoot, e)}`);
|
||||
await (0, _execa().default)('git', ['apply', // According to git documentation, `--binary` flag is turned on by
|
||||
// default. However it's necessary when running `git apply --check` to
|
||||
// actually accept binary files, maybe a bug in git?
|
||||
'--binary', '--check', tmpPatchFile, ...excludes, '-p2', '--3way', `--directory=${relativePathFromRoot}`]);
|
||||
|
||||
_cliTools().logger.info('Applying diff...');
|
||||
} catch (error) {
|
||||
const errorLines = error.stderr.split('\n');
|
||||
filesThatDontExist = [...errorLines.filter(x => x.includes('does not exist in index')).map(x => x.replace(/^error: (.*): does not exist in index$/, '$1'))].filter(Boolean);
|
||||
filesThatFailedToApply = errorLines.filter(x => x.includes('patch does not apply')).map(x => x.replace(/^error: (.*): patch does not apply$/, '$1')).filter(Boolean);
|
||||
|
||||
_cliTools().logger.info('Applying diff...');
|
||||
|
||||
_cliTools().logger.warn(`Excluding files that exist in the template, but not in your project:\n${filesThatDontExist.map(file => ` - ${_chalk().default.bold(file)}`).join('\n')}`);
|
||||
|
||||
if (filesThatFailedToApply.length) {
|
||||
_cliTools().logger.error(`Excluding files that failed to apply the diff:\n${filesThatFailedToApply.map(file => ` - ${_chalk().default.bold(file)}`).join('\n')}\nPlease make sure to check the actual changes after the upgrade command is finished.\nYou can find them in our Upgrade Helper web app: ${_chalk().default.underline.dim(`${webDiffUrl}/?from=${currentVersion}&to=${newVersion}`)}`);
|
||||
}
|
||||
} finally {
|
||||
const excludes = [...defaultExcludes, ...filesThatDontExist, ...filesThatFailedToApply].map(e => `--exclude=${_path().default.join(relativePathFromRoot, e)}`);
|
||||
await (0, _execa().default)('git', ['apply', tmpPatchFile, ...excludes, '-p2', '--3way', `--directory=${relativePathFromRoot}`]);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.stderr) {
|
||||
_cliTools().logger.debug(`"git apply" failed. Error output:\n${error.stderr}`);
|
||||
}
|
||||
|
||||
_cliTools().logger.error('Automatically applying diff failed. We did our best to automatically upgrade as many files as possible');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
* Upgrade application to a new version of React Native.
|
||||
*/
|
||||
|
||||
|
||||
async function upgrade(argv, ctx) {
|
||||
const tmpPatchFile = 'tmp-upgrade-rn.patch';
|
||||
const projectDir = ctx.root;
|
||||
|
||||
const {
|
||||
version: currentVersion
|
||||
} = require(_path().default.join(projectDir, 'node_modules/react-native/package.json'));
|
||||
|
||||
const newVersion = await getVersionToUpgradeTo(argv, currentVersion, projectDir);
|
||||
|
||||
if (!newVersion) {
|
||||
return;
|
||||
}
|
||||
|
||||
const patch = await getPatch(currentVersion, newVersion, ctx);
|
||||
|
||||
if (patch === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (patch === '') {
|
||||
_cliTools().logger.info('Diff has no changes to apply, proceeding further');
|
||||
|
||||
await installDeps(projectDir, newVersion);
|
||||
await installCocoaPodsDeps(projectDir);
|
||||
|
||||
_cliTools().logger.success(`Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let patchSuccess;
|
||||
|
||||
try {
|
||||
_fs().default.writeFileSync(tmpPatchFile, patch);
|
||||
|
||||
patchSuccess = await applyPatch(currentVersion, newVersion, tmpPatchFile);
|
||||
} catch (error) {
|
||||
throw new Error(error.stderr || error);
|
||||
} finally {
|
||||
try {
|
||||
_fs().default.unlinkSync(tmpPatchFile);
|
||||
} catch (e) {// ignore
|
||||
}
|
||||
|
||||
const {
|
||||
stdout
|
||||
} = await (0, _execa().default)('git', ['status', '-s']);
|
||||
|
||||
if (!patchSuccess) {
|
||||
if (stdout) {
|
||||
_cliTools().logger.warn('Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually');
|
||||
|
||||
await installDeps(projectDir, newVersion);
|
||||
|
||||
_cliTools().logger.info('Running "git status" to check what changed...');
|
||||
|
||||
await (0, _execa().default)('git', ['status'], {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
} else {
|
||||
_cliTools().logger.error('Patch failed to apply for unknown reason. Please fall back to manual way of upgrading');
|
||||
}
|
||||
} else {
|
||||
await installDeps(projectDir, newVersion);
|
||||
await installCocoaPodsDeps(projectDir);
|
||||
|
||||
_cliTools().logger.info('Running "git status" to check what changed...');
|
||||
|
||||
await (0, _execa().default)('git', ['status'], {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
||||
|
||||
if (!patchSuccess) {
|
||||
if (stdout) {
|
||||
_cliTools().logger.warn('Please run "git diff" to review the conflicts and resolve them');
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
_cliTools().logger.warn('After resolving conflicts don\'t forget to run "pod install" inside "ios" directory');
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`You may find these resources helpful:
|
||||
• Release notes: ${_chalk().default.underline.dim(`https://github.com/facebook/react-native/releases/tag/v${newVersion}`)}
|
||||
• Manual Upgrade Helper: ${_chalk().default.underline.dim(`${webDiffUrl}/?from=${currentVersion}&to=${newVersion}`)}
|
||||
• Git diff: ${_chalk().default.underline.dim(`${rawDiffUrl}/${currentVersion}..${newVersion}.diff`)}`);
|
||||
|
||||
throw new (_cliTools().CLIError)('Upgrade failed. Please see the messages above for details');
|
||||
}
|
||||
}
|
||||
|
||||
_cliTools().logger.success(`Upgraded React Native to v${newVersion} 🎉. Now you can review and commit the changes`);
|
||||
}
|
||||
|
||||
const upgradeCommand = {
|
||||
name: 'upgrade [version]',
|
||||
description: "Upgrade your app's template files to the specified or latest npm version using `rn-diff-purge` project. Only valid semver versions are allowed.",
|
||||
func: upgrade
|
||||
};
|
||||
var _default = upgradeCommand;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=upgrade.js.map
|
285
node_modules/@react-native-community/cli/build/index.js
generated
vendored
Normal file
285
node_modules/@react-native-community/cli/build/index.js
generated
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.run = run;
|
||||
Object.defineProperty(exports, "init", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _initCompat.default;
|
||||
}
|
||||
});
|
||||
exports.bin = void 0;
|
||||
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require("chalk"));
|
||||
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _child_process() {
|
||||
const data = _interopRequireDefault(require("child_process"));
|
||||
|
||||
_child_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _commander() {
|
||||
const data = _interopRequireDefault(require("commander"));
|
||||
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _leven() {
|
||||
const data = _interopRequireDefault(require("leven"));
|
||||
|
||||
_leven = 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;
|
||||
}
|
||||
|
||||
var _commands = require("./commands");
|
||||
|
||||
var _initCompat = _interopRequireDefault(require("./commands/init/initCompat"));
|
||||
|
||||
var _assertRequiredOptions = _interopRequireDefault(require("./tools/assertRequiredOptions"));
|
||||
|
||||
var _config = _interopRequireDefault(require("./tools/config"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const pkgJson = require("../package.json");
|
||||
|
||||
_commander().default.usage('<command> [options]').option('--version', 'Print CLI version').option('--verbose', 'Increase logging verbosity');
|
||||
|
||||
_commander().default.arguments('<command>').action(cmd => {
|
||||
printUnknownCommand(cmd);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const handleError = err => {
|
||||
if (_commander().default.verbose) {
|
||||
_cliTools().logger.error(err.message);
|
||||
} else {
|
||||
// Some error messages (esp. custom ones) might have `.` at the end already.
|
||||
const message = err.message.replace(/\.$/, '');
|
||||
|
||||
_cliTools().logger.error(`${message}. ${_chalk().default.dim(`Run CLI with ${_chalk().default.reset('--verbose')} ${_chalk().default.dim('flag for more details.')}`)}`);
|
||||
}
|
||||
|
||||
if (err.stack) {
|
||||
_cliTools().logger.log(_chalk().default.dim(err.stack));
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
};
|
||||
/**
|
||||
* Custom printHelpInformation command inspired by internal Commander.js
|
||||
* one modified to suit our needs
|
||||
*/
|
||||
|
||||
|
||||
function printHelpInformation(examples, pkg) {
|
||||
let cmdName = this._name;
|
||||
|
||||
const argsList = this._args.map(arg => arg.required ? `<${arg.name}>` : `[${arg.name}]`).join(' ');
|
||||
|
||||
if (this._alias) {
|
||||
cmdName = `${cmdName}|${this._alias}`;
|
||||
}
|
||||
|
||||
const sourceInformation = pkg ? [`${_chalk().default.bold('Source:')} ${pkg.name}@${pkg.version}`, ''] : [];
|
||||
let output = [_chalk().default.bold(`react-native ${cmdName} ${argsList}`), this._description ? `\n${this._description}\n` : '', ...sourceInformation, `${_chalk().default.bold('Options:')}`, this.optionHelp().replace(/^/gm, ' ')];
|
||||
|
||||
if (examples && examples.length > 0) {
|
||||
const formattedUsage = examples.map(example => ` ${example.desc}: \n ${_chalk().default.cyan(example.cmd)}`).join('\n\n');
|
||||
output = output.concat([_chalk().default.bold('\nExample usage:'), formattedUsage]);
|
||||
}
|
||||
|
||||
return output.join('\n').concat('\n');
|
||||
}
|
||||
|
||||
function printUnknownCommand(cmdName) {
|
||||
const availableCommands = _commander().default.commands.map(cmd => cmd._name);
|
||||
|
||||
const suggestion = availableCommands.find(cmd => {
|
||||
return (0, _leven().default)(cmd, cmdName) < cmd.length * 0.4;
|
||||
});
|
||||
let errorMsg = `Unrecognized command "${_chalk().default.bold(cmdName)}".`;
|
||||
|
||||
if (suggestion) {
|
||||
errorMsg += ` Did you mean "${suggestion}"?`;
|
||||
}
|
||||
|
||||
if (cmdName) {
|
||||
_cliTools().logger.error(errorMsg);
|
||||
|
||||
_cliTools().logger.info(`Run ${_chalk().default.bold('"react-native --help"')} to see a list of all available commands.`);
|
||||
} else {
|
||||
_commander().default.outputHelp();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Custom type assertion needed for the `makeCommand` conditional
|
||||
* types to be properly resolved.
|
||||
*/
|
||||
|
||||
|
||||
const isDetachedCommand = command => {
|
||||
return command.detached === true;
|
||||
};
|
||||
/**
|
||||
* Attaches a new command onto global `commander` instance.
|
||||
*
|
||||
* Note that this function takes additional argument of `Config` type in case
|
||||
* passed `command` needs it for its execution.
|
||||
*/
|
||||
|
||||
|
||||
function attachCommand(command, ...rest) {
|
||||
const options = command.options || [];
|
||||
|
||||
const cmd = _commander().default.command(command.name).action(async function handleAction(...args) {
|
||||
const passedOptions = this.opts();
|
||||
const argv = Array.from(args).slice(0, -1);
|
||||
|
||||
try {
|
||||
(0, _assertRequiredOptions.default)(options, passedOptions);
|
||||
|
||||
if (isDetachedCommand(command)) {
|
||||
await command.func(argv, passedOptions);
|
||||
} else {
|
||||
await command.func(argv, rest[0], passedOptions);
|
||||
}
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
}
|
||||
});
|
||||
|
||||
if (command.description) {
|
||||
cmd.description(command.description);
|
||||
}
|
||||
|
||||
cmd.helpInformation = printHelpInformation.bind(cmd, command.examples, command.pkg);
|
||||
|
||||
for (const opt of command.options || []) {
|
||||
cmd.option(opt.name, opt.description, opt.parse || (val => val), typeof opt.default === 'function' ? opt.default(rest[0]) : opt.default);
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
await setupAndRun();
|
||||
} catch (e) {
|
||||
handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function setupAndRun() {
|
||||
// Commander is not available yet
|
||||
// when we run `config`, we don't want to output anything to the console. We
|
||||
// expect it to return valid JSON
|
||||
if (process.argv.includes('config')) {
|
||||
_cliTools().logger.disable();
|
||||
}
|
||||
|
||||
_cliTools().logger.setVerbose(process.argv.includes('--verbose')); // We only have a setup script for UNIX envs currently
|
||||
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
const scriptName = 'setup_env.sh';
|
||||
|
||||
const absolutePath = _path().default.join(__dirname, '..', scriptName);
|
||||
|
||||
try {
|
||||
_child_process().default.execFileSync(absolutePath, {
|
||||
stdio: 'pipe'
|
||||
});
|
||||
} catch (error) {
|
||||
_cliTools().logger.warn(`Failed to run environment setup script "${scriptName}"\n\n${_chalk().default.red(error)}`);
|
||||
|
||||
_cliTools().logger.info(`React Native CLI will continue to run if your local environment matches what React Native expects. If it does fail, check out "${absolutePath}" and adjust your environment to match it.`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const command of _commands.detachedCommands) {
|
||||
attachCommand(command);
|
||||
}
|
||||
|
||||
try {
|
||||
const config = (0, _config.default)();
|
||||
|
||||
_cliTools().logger.enable();
|
||||
|
||||
for (const command of [..._commands.projectCommands, ...config.commands]) {
|
||||
attachCommand(command, config);
|
||||
}
|
||||
} catch (error) {
|
||||
/**
|
||||
* When there is no `package.json` found, the CLI will enter `detached` mode and a subset
|
||||
* of commands will be available. That's why we don't throw on such kind of error.
|
||||
*/
|
||||
if (error.message.includes("We couldn't find a package.json")) {
|
||||
_cliTools().logger.enable();
|
||||
|
||||
_cliTools().logger.debug(error.message);
|
||||
|
||||
_cliTools().logger.debug('Failed to load configuration of your project. Only a subset of commands will be available.');
|
||||
} else {
|
||||
throw new (_cliTools().CLIError)('Failed to load configuration of your project.', error);
|
||||
}
|
||||
}
|
||||
|
||||
_commander().default.parse(process.argv);
|
||||
|
||||
if (_commander().default.rawArgs.length === 2) {
|
||||
_commander().default.outputHelp();
|
||||
} // We handle --version as a special case like this because both `commander`
|
||||
// and `yargs` append it to every command and we don't want to do that.
|
||||
// E.g. outside command `init` has --version flag and we want to preserve it.
|
||||
|
||||
|
||||
if (_commander().default.args.length === 0 && _commander().default.rawArgs.includes('--version')) {
|
||||
console.log(pkgJson.version);
|
||||
}
|
||||
}
|
||||
|
||||
const bin = require.resolve("./bin");
|
||||
|
||||
exports.bin = bin;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
56
node_modules/@react-native-community/cli/build/tools/assertRequiredOptions.js
generated
vendored
Normal file
56
node_modules/@react-native-community/cli/build/tools/assertRequiredOptions.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = assertRequiredOptions;
|
||||
|
||||
function _commander() {
|
||||
const data = require("commander");
|
||||
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
// Commander.js has a 2 years old open issue to support <...> syntax
|
||||
// for options. Until that gets merged, we run the checks manually
|
||||
// https://github.com/tj/commander.js/issues/230
|
||||
function assertRequiredOptions(options, passedOptions) {
|
||||
options.forEach(opt => {
|
||||
const option = new (_commander().Option)(opt.name);
|
||||
|
||||
if (!option.required) {
|
||||
return;
|
||||
}
|
||||
|
||||
const name = (0, _lodash().camelCase)(option.long);
|
||||
|
||||
if (!passedOptions[name]) {
|
||||
// Provide commander.js like error message
|
||||
throw new Error(`Option "${option.long}" is missing`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=assertRequiredOptions.js.map
|
39
node_modules/@react-native-community/cli/build/tools/assign.js
generated
vendored
Normal file
39
node_modules/@react-native-community/cli/build/tools/assign.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = assign;
|
||||
|
||||
/**
|
||||
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
||||
*
|
||||
* Similar to Object.assign(), but it doesn't execute getters. This allows us to have
|
||||
* lazy properties on an object and still be able to merge them together
|
||||
*
|
||||
*/
|
||||
function assign(target, ...sources) {
|
||||
sources.forEach(source => {
|
||||
let descriptors = Object.keys(source).reduce((acc, key) => {
|
||||
const propertyDescriptor = Object.getOwnPropertyDescriptor(source, key);
|
||||
|
||||
if (propertyDescriptor !== undefined) {
|
||||
acc[key] = propertyDescriptor;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {}); // by default, Object.assign copies enumerable Symbols too
|
||||
|
||||
Object.getOwnPropertySymbols(source).forEach(sym => {
|
||||
let descriptor = Object.getOwnPropertyDescriptor(source, sym);
|
||||
|
||||
if (descriptor && descriptor.enumerable) {
|
||||
descriptors[sym.toString()] = descriptor;
|
||||
}
|
||||
});
|
||||
Object.defineProperties(target, descriptors);
|
||||
});
|
||||
return target;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=assign.js.map
|
53
node_modules/@react-native-community/cli/build/tools/brewInstall.js
generated
vendored
Normal file
53
node_modules/@react-native-community/cli/build/tools/brewInstall.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.brewInstall = brewInstall;
|
||||
|
||||
function _execa() {
|
||||
const data = _interopRequireDefault(require("execa"));
|
||||
|
||||
_execa = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _common = require("../commands/doctor/healthchecks/common");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
async function brewInstall({
|
||||
pkg,
|
||||
label,
|
||||
loader,
|
||||
onSuccess,
|
||||
onFail
|
||||
}) {
|
||||
loader.start(label);
|
||||
|
||||
try {
|
||||
await (0, _execa().default)('brew', ['install', pkg]);
|
||||
|
||||
if (typeof onSuccess === 'function') {
|
||||
return onSuccess();
|
||||
}
|
||||
|
||||
return loader.succeed();
|
||||
} catch (error) {
|
||||
if (typeof onFail === 'function') {
|
||||
return onFail();
|
||||
}
|
||||
|
||||
(0, _common.logError)({
|
||||
healthcheck: label || pkg,
|
||||
loader,
|
||||
error,
|
||||
command: `brew install ${pkg}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=brewInstall.js.map
|
57
node_modules/@react-native-community/cli/build/tools/config/errors.js
generated
vendored
Normal file
57
node_modules/@react-native-community/cli/build/tools/config/errors.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.JoiError = void 0;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
class JoiError extends _cliTools().CLIError {
|
||||
constructor(joiError) {
|
||||
super(joiError.details.map(error => {
|
||||
const name = error.path.join('.');
|
||||
|
||||
switch (error.type) {
|
||||
case 'object.allowUnknown':
|
||||
{
|
||||
const value = JSON.stringify(error.context && error.context.value);
|
||||
return `
|
||||
Unknown option ${name} with value "${value}" was found.
|
||||
This is either a typing error or a user mistake. Fixing it will remove this message.
|
||||
`;
|
||||
}
|
||||
|
||||
case 'object.base':
|
||||
case 'string.base':
|
||||
{
|
||||
const expectedType = error.type.replace('.base', '');
|
||||
const actualType = typeof (error.context && error.context.value);
|
||||
return `
|
||||
Option ${name} must be a ${expectedType}, instead got ${actualType}
|
||||
`;
|
||||
}
|
||||
|
||||
default:
|
||||
return error.message;
|
||||
}
|
||||
}).join());
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, JoiError);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.JoiError = JoiError;
|
||||
|
||||
//# sourceMappingURL=errors.js.map
|
53
node_modules/@react-native-community/cli/build/tools/config/findAssets.js
generated
vendored
Normal file
53
node_modules/@react-native-community/cli/build/tools/config/findAssets.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = findAssets;
|
||||
|
||||
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 }; }
|
||||
|
||||
const findAssetsInFolder = folder => {
|
||||
const assets = _glob().default.sync(_path().default.join(folder, '**'), {
|
||||
nodir: true
|
||||
});
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
return assets.map(asset => asset.split('/').join('\\'));
|
||||
}
|
||||
|
||||
return assets;
|
||||
};
|
||||
/**
|
||||
* Given an array of assets folders, e.g. ['Fonts', 'Images'],
|
||||
* it globs in them to find all files that can be copied.
|
||||
*
|
||||
* It returns an array of absolute paths to files found.
|
||||
*/
|
||||
|
||||
|
||||
function findAssets(folder, assets) {
|
||||
return (assets || []).map(asset => _path().default.join(folder, asset)).reduce((acc, assetPath) => acc.concat(findAssetsInFolder(assetPath)), []);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=findAssets.js.map
|
46
node_modules/@react-native-community/cli/build/tools/config/findDependencies.js
generated
vendored
Normal file
46
node_modules/@react-native-community/cli/build/tools/config/findDependencies.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = findDependencies;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Returns an array of dependencies from project's package.json
|
||||
*/
|
||||
function findDependencies(root) {
|
||||
let pjson;
|
||||
|
||||
try {
|
||||
pjson = JSON.parse(_fs().default.readFileSync(_path().default.join(root, 'package.json'), 'UTF-8'));
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const deps = [...Object.keys(pjson.dependencies || {}), ...Object.keys(pjson.devDependencies || {})];
|
||||
return deps;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=findDependencies.js.map
|
66
node_modules/@react-native-community/cli/build/tools/config/findProjectRoot.js
generated
vendored
Normal file
66
node_modules/@react-native-community/cli/build/tools/config/findProjectRoot.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = findProjectRoot;
|
||||
|
||||
function _findUp() {
|
||||
const data = _interopRequireDefault(require("find-up"));
|
||||
|
||||
_findUp = 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 }; }
|
||||
|
||||
/**
|
||||
* Finds project root by looking for a closest `package.json`.
|
||||
*/
|
||||
function findProjectRoot(cwd = process.cwd()) {
|
||||
const packageLocation = _findUp().default.sync('package.json', {
|
||||
cwd
|
||||
});
|
||||
/**
|
||||
* It is possible that `package.json` doesn't exist
|
||||
* in the tree. In that case, we want to throw an error.
|
||||
*
|
||||
* When executing via `npx`, this will never happen as `npm`
|
||||
* requires that file to be present in order to run.
|
||||
*/
|
||||
|
||||
|
||||
if (!packageLocation) {
|
||||
throw new (_cliTools().CLIError)(`
|
||||
We couldn't find a package.json in your project.
|
||||
Are you sure you are running it inside a React Native project?
|
||||
`);
|
||||
}
|
||||
|
||||
return _path().default.dirname(packageLocation);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=findProjectRoot.js.map
|
151
node_modules/@react-native-community/cli/build/tools/config/index.js
generated
vendored
Normal file
151
node_modules/@react-native-community/cli/build/tools/config/index.js
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
"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 _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 _findDependencies = _interopRequireDefault(require("./findDependencies"));
|
||||
|
||||
var _findProjectRoot = _interopRequireDefault(require("./findProjectRoot"));
|
||||
|
||||
var _resolveReactNativePath = _interopRequireDefault(require("./resolveReactNativePath"));
|
||||
|
||||
var _findAssets = _interopRequireDefault(require("./findAssets"));
|
||||
|
||||
var _readConfigFromDisk = require("./readConfigFromDisk");
|
||||
|
||||
var _assign = _interopRequireDefault(require("../assign"));
|
||||
|
||||
var _merge = _interopRequireDefault(require("../merge"));
|
||||
|
||||
var _resolveNodeModuleDir = _interopRequireDefault(require("./resolveNodeModuleDir"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function getDependencyConfig(root, dependencyName, finalConfig, config, userConfig, isPlatform) {
|
||||
return (0, _merge.default)({
|
||||
root,
|
||||
name: dependencyName,
|
||||
platforms: Object.keys(finalConfig.platforms).reduce((dependency, platform) => {
|
||||
const platformConfig = finalConfig.platforms[platform];
|
||||
dependency[platform] = // Linking platforms is not supported
|
||||
isPlatform || !platformConfig ? null : platformConfig.dependencyConfig(root, config.dependency.platforms[platform]);
|
||||
return dependency;
|
||||
}, {}),
|
||||
assets: (0, _findAssets.default)(root, config.dependency.assets),
|
||||
hooks: config.dependency.hooks,
|
||||
params: config.dependency.params
|
||||
}, userConfig.dependencies[dependencyName] || {});
|
||||
}
|
||||
/**
|
||||
* Loads CLI configuration
|
||||
*/
|
||||
|
||||
|
||||
function loadConfig(projectRoot = (0, _findProjectRoot.default)()) {
|
||||
let lazyProject;
|
||||
const userConfig = (0, _readConfigFromDisk.readConfigFromDisk)(projectRoot);
|
||||
const initialConfig = {
|
||||
root: projectRoot,
|
||||
|
||||
get reactNativePath() {
|
||||
return userConfig.reactNativePath ? _path().default.resolve(projectRoot, userConfig.reactNativePath) : (0, _resolveReactNativePath.default)(projectRoot);
|
||||
},
|
||||
|
||||
dependencies: userConfig.dependencies,
|
||||
commands: userConfig.commands,
|
||||
|
||||
get assets() {
|
||||
return (0, _findAssets.default)(projectRoot, userConfig.assets);
|
||||
},
|
||||
|
||||
platforms: userConfig.platforms,
|
||||
|
||||
get project() {
|
||||
if (lazyProject) {
|
||||
return lazyProject;
|
||||
}
|
||||
|
||||
lazyProject = {};
|
||||
|
||||
for (const platform in finalConfig.platforms) {
|
||||
const platformConfig = finalConfig.platforms[platform];
|
||||
|
||||
if (platformConfig) {
|
||||
lazyProject[platform] = platformConfig.projectConfig(projectRoot, userConfig.project[platform] || {});
|
||||
}
|
||||
}
|
||||
|
||||
return lazyProject;
|
||||
}
|
||||
|
||||
};
|
||||
const finalConfig = Array.from(new Set([...Object.keys(userConfig.dependencies), ...(0, _findDependencies.default)(projectRoot)])).reduce((acc, dependencyName) => {
|
||||
const localDependencyRoot = userConfig.dependencies[dependencyName] && userConfig.dependencies[dependencyName].root;
|
||||
let root;
|
||||
let config;
|
||||
|
||||
try {
|
||||
root = localDependencyRoot || (0, _resolveNodeModuleDir.default)(projectRoot, dependencyName);
|
||||
config = (0, _readConfigFromDisk.readDependencyConfigFromDisk)(root);
|
||||
} catch (error) {
|
||||
_cliTools().logger.warn((0, _cliTools().inlineString)(`
|
||||
Package ${_chalk().default.bold(dependencyName)} has been ignored because it contains invalid configuration.
|
||||
|
||||
Reason: ${_chalk().default.dim(error.message)}`));
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
const isPlatform = Object.keys(config.platforms).length > 0;
|
||||
return (0, _assign.default)({}, acc, {
|
||||
dependencies: (0, _assign.default)({}, acc.dependencies, {
|
||||
get [dependencyName]() {
|
||||
return getDependencyConfig(root, dependencyName, finalConfig, config, userConfig, isPlatform);
|
||||
}
|
||||
|
||||
}),
|
||||
commands: [...acc.commands, ...config.commands],
|
||||
platforms: { ...acc.platforms,
|
||||
...config.platforms
|
||||
}
|
||||
});
|
||||
}, initialConfig);
|
||||
return finalConfig;
|
||||
}
|
||||
|
||||
var _default = loadConfig;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
98
node_modules/@react-native-community/cli/build/tools/config/readConfigFromDisk.js
generated
vendored
Normal file
98
node_modules/@react-native-community/cli/build/tools/config/readConfigFromDisk.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.readConfigFromDisk = readConfigFromDisk;
|
||||
exports.readDependencyConfigFromDisk = readDependencyConfigFromDisk;
|
||||
|
||||
function _joi() {
|
||||
const data = _interopRequireDefault(require("@hapi/joi"));
|
||||
|
||||
_joi = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cosmiconfig() {
|
||||
const data = _interopRequireDefault(require("cosmiconfig"));
|
||||
|
||||
_cosmiconfig = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _errors = require("./errors");
|
||||
|
||||
var schema = _interopRequireWildcard(require("./schema"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Places to look for the configuration file.
|
||||
*/
|
||||
const searchPlaces = ['react-native.config.js'];
|
||||
/**
|
||||
* Reads a project configuration as defined by the user in the current
|
||||
* workspace.
|
||||
*/
|
||||
|
||||
function readConfigFromDisk(rootFolder) {
|
||||
const explorer = (0, _cosmiconfig().default)('react-native', {
|
||||
searchPlaces,
|
||||
stopDir: rootFolder
|
||||
});
|
||||
const searchResult = explorer.searchSync(rootFolder);
|
||||
const config = searchResult ? searchResult.config : undefined;
|
||||
|
||||
const result = _joi().default.validate(config, schema.projectConfig);
|
||||
|
||||
if (result.error) {
|
||||
throw new _errors.JoiError(result.error);
|
||||
}
|
||||
|
||||
return result.value;
|
||||
}
|
||||
/**
|
||||
* Reads a dependency configuration as defined by the developer
|
||||
* inside `node_modules`.
|
||||
*/
|
||||
|
||||
|
||||
function readDependencyConfigFromDisk(rootFolder) {
|
||||
const explorer = (0, _cosmiconfig().default)('react-native', {
|
||||
stopDir: rootFolder,
|
||||
searchPlaces
|
||||
});
|
||||
const searchResult = explorer.searchSync(rootFolder);
|
||||
const config = searchResult ? searchResult.config : emptyDependencyConfig;
|
||||
|
||||
const result = _joi().default.validate(config, schema.dependencyConfig);
|
||||
|
||||
if (result.error) {
|
||||
throw new _errors.JoiError(result.error);
|
||||
}
|
||||
|
||||
return result.value;
|
||||
}
|
||||
|
||||
const emptyDependencyConfig = {
|
||||
dependency: {
|
||||
platforms: {},
|
||||
assets: [],
|
||||
hooks: {},
|
||||
params: []
|
||||
},
|
||||
commands: [],
|
||||
platforms: {}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=readConfigFromDisk.js.map
|
29
node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
generated
vendored
Normal file
29
node_modules/@react-native-community/cli/build/tools/config/resolveNodeModuleDir.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = resolveNodeModuleDir;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Finds a path inside `node_modules`
|
||||
*/
|
||||
function resolveNodeModuleDir(root, packageName) {
|
||||
return _path().default.dirname(require.resolve(_path().default.join(packageName, 'package.json'), {
|
||||
paths: [root]
|
||||
}));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=resolveNodeModuleDir.js.map
|
43
node_modules/@react-native-community/cli/build/tools/config/resolveReactNativePath.js
generated
vendored
Normal file
43
node_modules/@react-native-community/cli/build/tools/config/resolveReactNativePath.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = resolveReactNativePath;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _resolveNodeModuleDir = _interopRequireDefault(require("./resolveNodeModuleDir"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Finds path to React Native inside `node_modules` or throws
|
||||
* an error otherwise.
|
||||
*/
|
||||
function resolveReactNativePath(root) {
|
||||
try {
|
||||
return (0, _resolveNodeModuleDir.default)(root, 'react-native');
|
||||
} catch (_ignored) {
|
||||
throw new (_cliTools().CLIError)(`
|
||||
Unable to find React Native files looking up from ${root}. Make sure "react-native" module is installed
|
||||
in your project dependencies.
|
||||
|
||||
If you are using React Native from a non-standard location, consider setting:
|
||||
{
|
||||
reactNativePath: "./path/to/react-native"
|
||||
}
|
||||
in your \`react-native.config.js\`.
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=resolveReactNativePath.js.map
|
149
node_modules/@react-native-community/cli/build/tools/config/schema.js
generated
vendored
Normal file
149
node_modules/@react-native-community/cli/build/tools/config/schema.js
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.projectConfig = exports.dependencyConfig = void 0;
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@hapi/joi"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const map = (key, value) => t().object().unknown(true).pattern(key, value);
|
||||
/**
|
||||
* Schema for CommandT
|
||||
*/
|
||||
|
||||
|
||||
const command = t().object({
|
||||
name: t().string().required(),
|
||||
description: t().string(),
|
||||
usage: t().string(),
|
||||
func: t().func().required(),
|
||||
options: t().array().items(t().object({
|
||||
name: t().string().required(),
|
||||
description: t().string(),
|
||||
parse: t().func(),
|
||||
default: t().alternatives().try([t().bool(), t().number(), t().string().allow(''), t().func()])
|
||||
}).rename('command', 'name', {
|
||||
ignoreUndefined: true
|
||||
})),
|
||||
examples: t().array().items(t().object({
|
||||
desc: t().string().required(),
|
||||
cmd: t().string().required()
|
||||
}))
|
||||
});
|
||||
/**
|
||||
* Schema for UserDependencyConfigT
|
||||
*/
|
||||
|
||||
const dependencyConfig = t().object({
|
||||
dependency: t().object({
|
||||
platforms: map(t().string(), t().any()).keys({
|
||||
ios: t().object({
|
||||
project: t().string(),
|
||||
podspecPath: t().string(),
|
||||
sharedLibraries: t().array().items(t().string()),
|
||||
libraryFolder: t().string(),
|
||||
scriptPhases: t().array().items(t().object())
|
||||
}).default({}),
|
||||
android: t().object({
|
||||
sourceDir: t().string(),
|
||||
manifestPath: t().string(),
|
||||
packageImportPath: t().string(),
|
||||
packageInstance: t().string()
|
||||
}).default({})
|
||||
}).default(),
|
||||
assets: t().array().items(t().string()).default([]),
|
||||
hooks: map(t().string(), t().string()).default({}),
|
||||
params: t().array().items(t().object({
|
||||
name: t().string(),
|
||||
type: t().string(),
|
||||
message: t().string()
|
||||
})).default([])
|
||||
}).default(),
|
||||
platforms: map(t().string(), t().object({
|
||||
npmPackageName: t().string().optional(),
|
||||
dependencyConfig: t().func(),
|
||||
projectConfig: t().func(),
|
||||
linkConfig: t().func()
|
||||
})).default({}),
|
||||
commands: t().array().items(command).default([])
|
||||
}).unknown(true).default();
|
||||
/**
|
||||
* Schema for ProjectConfigT
|
||||
*/
|
||||
|
||||
exports.dependencyConfig = dependencyConfig;
|
||||
const projectConfig = t().object({
|
||||
dependencies: map(t().string(), t().object({
|
||||
root: t().string(),
|
||||
platforms: map(t().string(), t().any()).keys({
|
||||
ios: t().object({
|
||||
sourceDir: t().string(),
|
||||
folder: t().string(),
|
||||
pbxprojPath: t().string(),
|
||||
podfile: t().string(),
|
||||
podspecPath: t().string(),
|
||||
projectPath: t().string(),
|
||||
projectName: t().string(),
|
||||
libraryFolder: t().string(),
|
||||
sharedLibraries: t().array().items(t().string())
|
||||
}).allow(null),
|
||||
android: t().object({
|
||||
sourceDir: t().string(),
|
||||
folder: t().string(),
|
||||
packageImportPath: t().string(),
|
||||
packageInstance: t().string()
|
||||
}).allow(null)
|
||||
}),
|
||||
assets: t().array().items(t().string()),
|
||||
hooks: map(t().string(), t().string()),
|
||||
params: t().array().items(t().object({
|
||||
name: t().string(),
|
||||
type: t().string(),
|
||||
message: t().string()
|
||||
}))
|
||||
}).allow(null)).default({}),
|
||||
reactNativePath: t().string(),
|
||||
project: map(t().string(), t().any()).keys({
|
||||
ios: t().object({
|
||||
project: t().string(),
|
||||
sharedLibraries: t().array().items(t().string()),
|
||||
libraryFolder: t().string()
|
||||
}).default({}),
|
||||
android: t().object({
|
||||
sourceDir: t().string(),
|
||||
manifestPath: t().string(),
|
||||
packageName: t().string(),
|
||||
packageFolder: t().string(),
|
||||
mainFilePath: t().string(),
|
||||
stringsPath: t().string(),
|
||||
settingsGradlePath: t().string(),
|
||||
assetsPath: t().string(),
|
||||
buildGradlePath: t().string(),
|
||||
appName: t().string()
|
||||
}).default({})
|
||||
}).default(),
|
||||
assets: t().array().items(t().string()).default([]),
|
||||
commands: t().array().items(command).default([]),
|
||||
platforms: map(t().string(), t().object({
|
||||
npmPackageName: t().string().optional(),
|
||||
dependencyConfig: t().func(),
|
||||
projectConfig: t().func(),
|
||||
linkConfig: t().func()
|
||||
})).default({})
|
||||
}).unknown(true).default();
|
||||
exports.projectConfig = projectConfig;
|
||||
|
||||
//# sourceMappingURL=schema.js.map
|
178
node_modules/@react-native-community/cli/build/tools/copyAndReplace.js
generated
vendored
Normal file
178
node_modules/@react-native-community/cli/build/tools/copyAndReplace.js
generated
vendored
Normal file
@ -0,0 +1,178 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
// Binary files, don't process these (avoid decoding as utf8)
|
||||
const binaryExtensions = ['.png', '.jar', '.keystore'];
|
||||
|
||||
/**
|
||||
* Copy a file to given destination, replacing parts of its contents.
|
||||
* @param srcPath Path to a file to be copied.
|
||||
* @param destPath Destination path.
|
||||
* @param replacements: e.g. {'TextToBeReplaced': 'Replacement'}
|
||||
* @param contentChangedCallback
|
||||
* Used when upgrading projects. Based on if file contents would change
|
||||
* when being replaced, allows the caller to specify whether the file
|
||||
* should be replaced or not.
|
||||
* If null, files will be overwritten.
|
||||
* Function(path, 'identical' | 'changed' | 'new') => 'keep' | 'overwrite'
|
||||
*/
|
||||
function copyAndReplace(srcPath, destPath, replacements, contentChangedCallback) {
|
||||
if (_fs().default.lstatSync(srcPath).isDirectory()) {
|
||||
if (!_fs().default.existsSync(destPath)) {
|
||||
_fs().default.mkdirSync(destPath);
|
||||
} // Not recursive
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const extension = _path().default.extname(srcPath);
|
||||
|
||||
if (binaryExtensions.indexOf(extension) !== -1) {
|
||||
// Binary file
|
||||
let shouldOverwrite = 'overwrite';
|
||||
|
||||
if (contentChangedCallback) {
|
||||
const newContentBuffer = _fs().default.readFileSync(srcPath);
|
||||
|
||||
let contentChanged = 'identical';
|
||||
|
||||
try {
|
||||
const origContentBuffer = _fs().default.readFileSync(destPath);
|
||||
|
||||
if (Buffer.compare(origContentBuffer, newContentBuffer) !== 0) {
|
||||
contentChanged = 'changed';
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
contentChanged = 'new';
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
shouldOverwrite = contentChangedCallback(destPath, contentChanged);
|
||||
}
|
||||
|
||||
if (shouldOverwrite === 'overwrite') {
|
||||
copyBinaryFile(srcPath, destPath, err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Text file
|
||||
const srcPermissions = _fs().default.statSync(srcPath).mode;
|
||||
|
||||
let content = _fs().default.readFileSync(srcPath, 'utf8');
|
||||
|
||||
Object.keys(replacements).forEach(regex => {
|
||||
content = content.replace(new RegExp(regex, 'g'), replacements[regex]);
|
||||
});
|
||||
let shouldOverwrite = 'overwrite';
|
||||
|
||||
if (contentChangedCallback) {
|
||||
// Check if contents changed and ask to overwrite
|
||||
let contentChanged = 'identical';
|
||||
|
||||
try {
|
||||
const origContent = _fs().default.readFileSync(destPath, 'utf8');
|
||||
|
||||
if (content !== origContent) {
|
||||
// logger.info('Content changed: ' + destPath);
|
||||
contentChanged = 'changed';
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
contentChanged = 'new';
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
shouldOverwrite = contentChangedCallback(destPath, contentChanged);
|
||||
}
|
||||
|
||||
if (shouldOverwrite === 'overwrite') {
|
||||
_fs().default.writeFileSync(destPath, content, {
|
||||
encoding: 'utf8',
|
||||
mode: srcPermissions
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Same as 'cp' on Unix. Don't do any replacements.
|
||||
*/
|
||||
|
||||
|
||||
function copyBinaryFile(srcPath, destPath, cb) {
|
||||
let cbCalled = false;
|
||||
|
||||
const srcPermissions = _fs().default.statSync(srcPath).mode;
|
||||
|
||||
const readStream = _fs().default.createReadStream(srcPath);
|
||||
|
||||
readStream.on('error', err => {
|
||||
done(err);
|
||||
});
|
||||
|
||||
const writeStream = _fs().default.createWriteStream(destPath, {
|
||||
mode: srcPermissions
|
||||
});
|
||||
|
||||
writeStream.on('error', err => {
|
||||
done(err);
|
||||
});
|
||||
writeStream.on('close', () => {
|
||||
done();
|
||||
});
|
||||
readStream.pipe(writeStream);
|
||||
|
||||
function done(err) {
|
||||
if (!cbCalled) {
|
||||
cb(err);
|
||||
cbCalled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _default = copyAndReplace;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=copyAndReplace.js.map
|
120
node_modules/@react-native-community/cli/build/tools/copyFiles.js
generated
vendored
Normal file
120
node_modules/@react-native-community/cli/build/tools/copyFiles.js
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var _walk = _interopRequireDefault(require("./walk"));
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copy files (binary included) recursively.
|
||||
*/
|
||||
async function copyFiles(srcPath, destPath, options = {}) {
|
||||
return Promise.all((0, _walk.default)(srcPath).map(async absoluteSrcFilePath => {
|
||||
const exclude = options.exclude;
|
||||
|
||||
if (exclude && exclude.some(p => p.test(absoluteSrcFilePath))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const relativeFilePath = _path().default.relative(srcPath, absoluteSrcFilePath);
|
||||
|
||||
await copyFile(absoluteSrcFilePath, _path().default.resolve(destPath, relativeFilePath));
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Copy a file to given destination.
|
||||
*/
|
||||
|
||||
|
||||
function copyFile(srcPath, destPath) {
|
||||
if (_fs().default.lstatSync(srcPath).isDirectory()) {
|
||||
if (!_fs().default.existsSync(destPath)) {
|
||||
_fs().default.mkdirSync(destPath);
|
||||
} // Not recursive
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
copyBinaryFile(srcPath, destPath, err => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
resolve(destPath);
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Same as 'cp' on Unix. Don't do any replacements.
|
||||
*/
|
||||
|
||||
|
||||
function copyBinaryFile(srcPath, destPath, cb) {
|
||||
let cbCalled = false;
|
||||
|
||||
const {
|
||||
mode
|
||||
} = _fs().default.statSync(srcPath);
|
||||
|
||||
const readStream = _fs().default.createReadStream(srcPath);
|
||||
|
||||
const writeStream = _fs().default.createWriteStream(destPath);
|
||||
|
||||
readStream.on('error', err => {
|
||||
done(err);
|
||||
});
|
||||
writeStream.on('error', err => {
|
||||
done(err);
|
||||
});
|
||||
readStream.on('close', () => {
|
||||
done();
|
||||
|
||||
_fs().default.chmodSync(destPath, mode);
|
||||
});
|
||||
readStream.pipe(writeStream);
|
||||
|
||||
function done(err) {
|
||||
if (!cbCalled) {
|
||||
cb(err);
|
||||
cbCalled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _default = copyFiles;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=copyFiles.js.map
|
31
node_modules/@react-native-community/cli/build/tools/deleteFile.js
generated
vendored
Normal file
31
node_modules/@react-native-community/cli/build/tools/deleteFile.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.deleteFile = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _util() {
|
||||
const data = require("util");
|
||||
|
||||
_util = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const deleteFile = (0, _util().promisify)(_fs().unlink);
|
||||
exports.deleteFile = deleteFile;
|
||||
|
||||
//# sourceMappingURL=deleteFile.js.map
|
45
node_modules/@react-native-community/cli/build/tools/downloadAndUnzip.js
generated
vendored
Normal file
45
node_modules/@react-native-community/cli/build/tools/downloadAndUnzip.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.downloadAndUnzip = void 0;
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _unzip = require("./unzip");
|
||||
|
||||
var _deleteFile = require("./deleteFile");
|
||||
|
||||
/**
|
||||
* Downloads `downloadUrl` and unzips the contents to `installPath` while
|
||||
* updating the message of `loader` at each step.
|
||||
*/
|
||||
const downloadAndUnzip = async ({
|
||||
loader,
|
||||
downloadUrl,
|
||||
component,
|
||||
installPath
|
||||
}) => {
|
||||
loader.start(`Downloading ${component} from "${downloadUrl}" (this may take a few minutes)`);
|
||||
const installer = await (0, _cliTools().fetchToTemp)(downloadUrl);
|
||||
loader.text = `Installing ${component} in "${installPath}"`;
|
||||
|
||||
try {
|
||||
await (0, _unzip.unzip)(installer, installPath);
|
||||
} finally {
|
||||
await (0, _deleteFile.deleteFile)(installer);
|
||||
}
|
||||
};
|
||||
|
||||
exports.downloadAndUnzip = downloadAndUnzip;
|
||||
|
||||
//# sourceMappingURL=downloadAndUnzip.js.map
|
68
node_modules/@react-native-community/cli/build/tools/envinfo.js
generated
vendored
Normal file
68
node_modules/@react-native-community/cli/build/tools/envinfo.js
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _envinfo() {
|
||||
const data = _interopRequireDefault(require("envinfo"));
|
||||
|
||||
_envinfo = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _os() {
|
||||
const data = require("os");
|
||||
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @ts-ignore
|
||||
async function getEnvironmentInfo(json = true) {
|
||||
const options = {
|
||||
json,
|
||||
showNotFound: true
|
||||
};
|
||||
let packages = ['react', 'react-native', '@react-native-community/cli'];
|
||||
const outOfTreePlatforms = {
|
||||
darwin: 'react-native-macos',
|
||||
win32: 'react-native-windows'
|
||||
};
|
||||
const outOfTreePlatformPackage = outOfTreePlatforms[(0, _os().platform)()];
|
||||
|
||||
if (outOfTreePlatformPackage) {
|
||||
packages.push(outOfTreePlatformPackage);
|
||||
}
|
||||
|
||||
const info = await _envinfo().default.run({
|
||||
System: ['OS', 'CPU', 'Memory', 'Shell'],
|
||||
Binaries: ['Node', 'Yarn', 'npm', 'Watchman'],
|
||||
IDEs: ['Xcode', 'Android Studio', 'Visual Studio'],
|
||||
Managers: ['CocoaPods'],
|
||||
Languages: ['Java', 'Python'],
|
||||
SDKs: ['iOS SDK', 'Android SDK', 'Windows SDK'],
|
||||
npmPackages: packages,
|
||||
npmGlobalPackages: ['*react-native*']
|
||||
}, options);
|
||||
|
||||
if (options.json) {
|
||||
return JSON.parse(info);
|
||||
}
|
||||
|
||||
return info.trim();
|
||||
}
|
||||
|
||||
var _default = getEnvironmentInfo;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=envinfo.js.map
|
187
node_modules/@react-native-community/cli/build/tools/generator/copyProjectTemplateAndReplace.js
generated
vendored
Normal file
187
node_modules/@react-native-community/cli/build/tools/generator/copyProjectTemplateAndReplace.js
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
"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 _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _copyAndReplace = _interopRequireDefault(require("../copyAndReplace"));
|
||||
|
||||
var _promptSync = _interopRequireDefault(require("./promptSync"));
|
||||
|
||||
var _walk = _interopRequireDefault(require("../walk"));
|
||||
|
||||
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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
const prompt = (0, _promptSync.default)();
|
||||
|
||||
/**
|
||||
* Util for creating a new React Native project.
|
||||
* Copy the project from a template and use the correct project name in
|
||||
* all files.
|
||||
* @param srcPath e.g. '/Users/martin/AwesomeApp/node_modules/react-native/template'
|
||||
* @param destPath e.g. '/Users/martin/AwesomeApp'
|
||||
* @param newProjectName e.g. 'AwesomeApp'
|
||||
* @param options e.g. {
|
||||
* upgrade: true,
|
||||
* force: false,
|
||||
* displayName: 'Hello World',
|
||||
* ignorePaths: ['template/file/to/ignore.md'],
|
||||
* }
|
||||
*/
|
||||
function copyProjectTemplateAndReplace(srcPath, destPath, newProjectName, options = {}) {
|
||||
if (!srcPath) {
|
||||
throw new Error('Need a path to copy from');
|
||||
}
|
||||
|
||||
if (!destPath) {
|
||||
throw new Error('Need a path to copy to');
|
||||
}
|
||||
|
||||
if (!newProjectName) {
|
||||
throw new Error('Need a project name');
|
||||
}
|
||||
|
||||
(0, _walk.default)(srcPath).forEach(absoluteSrcFilePath => {
|
||||
// 'react-native upgrade'
|
||||
if (options.upgrade) {
|
||||
// Don't upgrade these files
|
||||
const fileName = _path().default.basename(absoluteSrcFilePath); // This also includes __tests__/index.*.js
|
||||
|
||||
|
||||
if (fileName === 'index.ios.js') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileName === 'index.android.js') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileName === 'index.js') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileName === 'App.js') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const relativeFilePath = translateFilePath(_path().default.relative(srcPath, absoluteSrcFilePath)).replace(/HelloWorld/g, newProjectName).replace(/helloworld/g, newProjectName.toLowerCase()); // Templates may contain files that we don't want to copy.
|
||||
// Examples:
|
||||
// - Dummy package.json file included in the template only for publishing to npm
|
||||
// - Docs specific to the template (.md files)
|
||||
|
||||
if (options.ignorePaths) {
|
||||
if (!Array.isArray(options.ignorePaths)) {
|
||||
throw new Error('options.ignorePaths must be an array');
|
||||
}
|
||||
|
||||
if (options.ignorePaths.some(ignorePath => ignorePath === relativeFilePath)) {
|
||||
// Skip copying this file
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let contentChangedCallback = null;
|
||||
|
||||
if (options.upgrade && !options.force) {
|
||||
contentChangedCallback = (_destPath, contentChanged) => upgradeFileContentChangedCallback(absoluteSrcFilePath, relativeFilePath, contentChanged);
|
||||
}
|
||||
|
||||
(0, _copyAndReplace.default)(absoluteSrcFilePath, _path().default.resolve(destPath, relativeFilePath), {
|
||||
'Hello App Display Name': options.displayName || newProjectName,
|
||||
HelloWorld: newProjectName,
|
||||
helloworld: newProjectName.toLowerCase()
|
||||
}, contentChangedCallback);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* There are various files in the templates folder in the RN repo. We want
|
||||
* these to be ignored by tools when working with React Native itself.
|
||||
* Example: _babelrc file is ignored by Babel, renamed to .babelrc inside
|
||||
* a real app folder.
|
||||
* This is especially important for .gitignore because npm has some special
|
||||
* behavior of automatically renaming .gitignore to .npmignore.
|
||||
*/
|
||||
|
||||
|
||||
function translateFilePath(filePath) {
|
||||
if (!filePath) {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
return filePath.replace('_BUCK', 'BUCK').replace('_gitignore', '.gitignore').replace('_gitattributes', '.gitattributes').replace('_babelrc', '.babelrc').replace('_eslintrc.js', '.eslintrc.js').replace('_flowconfig', '.flowconfig').replace('_buckconfig', '.buckconfig').replace('_prettierrc.js', '.prettierrc.js').replace('_watchmanconfig', '.watchmanconfig');
|
||||
}
|
||||
|
||||
function upgradeFileContentChangedCallback(absoluteSrcFilePath, relativeDestPath, contentChanged) {
|
||||
if (contentChanged === 'new') {
|
||||
_cliTools().logger.info(`${_chalk().default.bold('new')} ${relativeDestPath}`);
|
||||
|
||||
return 'overwrite';
|
||||
}
|
||||
|
||||
if (contentChanged === 'changed') {
|
||||
_cliTools().logger.info(`${_chalk().default.bold(relativeDestPath)} ` + `has changed in the new version.\nDo you want to keep your ${relativeDestPath} or replace it with the ` + 'latest version?\nIf you ever made any changes ' + "to this file, you'll probably want to keep it.\n" + `You can see the new version here: ${absoluteSrcFilePath}\n` + `Do you want to replace ${relativeDestPath}? ` + 'Answer y to replace, n to keep your version: ');
|
||||
|
||||
const answer = prompt();
|
||||
|
||||
if (answer === 'y') {
|
||||
_cliTools().logger.info(`Replacing ${relativeDestPath}`);
|
||||
|
||||
return 'overwrite';
|
||||
}
|
||||
|
||||
_cliTools().logger.info(`Keeping your ${relativeDestPath}`);
|
||||
|
||||
return 'keep';
|
||||
}
|
||||
|
||||
if (contentChanged === 'identical') {
|
||||
return 'keep';
|
||||
}
|
||||
|
||||
throw new Error(`Unknown file changed state: ${relativeDestPath}, ${contentChanged}`);
|
||||
}
|
||||
|
||||
var _default = copyProjectTemplateAndReplace;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=copyProjectTemplateAndReplace.js.map
|
164
node_modules/@react-native-community/cli/build/tools/generator/promptSync.js
generated
vendored
Normal file
164
node_modules/@react-native-community/cli/build/tools/generator/promptSync.js
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = 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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
// Simplified version of:
|
||||
// https://github.com/0x00A/prompt-sync/blob/master/index.js
|
||||
const term = 13; // carriage return
|
||||
|
||||
function create() {
|
||||
return prompt;
|
||||
|
||||
function prompt(ask, value, opts) {
|
||||
let insert = 0;
|
||||
opts = opts || {};
|
||||
|
||||
if (typeof ask === 'object') {
|
||||
opts = ask;
|
||||
ask = opts.ask;
|
||||
} else if (typeof value === 'object') {
|
||||
opts = value;
|
||||
value = opts.value;
|
||||
}
|
||||
|
||||
ask = ask || '';
|
||||
const echo = opts.echo;
|
||||
const masked = ('echo' in opts);
|
||||
let fd;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// @ts-ignore
|
||||
fd = process.stdin.fd;
|
||||
} else {
|
||||
fd = _fs().default.openSync('/dev/tty', 'rs');
|
||||
}
|
||||
|
||||
const wasRaw = process.stdin.isRaw;
|
||||
|
||||
if (!wasRaw && process.stdin.setRawMode) {
|
||||
process.stdin.setRawMode(true);
|
||||
}
|
||||
|
||||
let buf = Buffer.alloc(3);
|
||||
let str = '';
|
||||
let character;
|
||||
let read;
|
||||
|
||||
if (ask) {
|
||||
process.stdout.write(ask);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
read = _fs().default.readSync(fd, buf, 0, 3, null);
|
||||
|
||||
if (read > 1) {
|
||||
// received a control sequence
|
||||
if (buf.toString()) {
|
||||
str += buf.toString();
|
||||
str = str.replace(/\0/g, '');
|
||||
insert = str.length;
|
||||
process.stdout.write(`\u001b[2K\u001b[0G${ask}${str}`);
|
||||
process.stdout.write(`\u001b[${insert + ask.length + 1}G`);
|
||||
buf = Buffer.alloc(3);
|
||||
}
|
||||
|
||||
continue; // any other 3 character sequence is ignored
|
||||
} // if it is not a control character seq, assume only one character is read
|
||||
|
||||
|
||||
character = buf[read - 1]; // catch a ^C and return null
|
||||
|
||||
if (character === 3) {
|
||||
process.stdout.write('^C\n');
|
||||
|
||||
_fs().default.closeSync(fd);
|
||||
|
||||
process.exit(130);
|
||||
|
||||
if (process.stdin.setRawMode) {
|
||||
process.stdin.setRawMode(!!wasRaw);
|
||||
}
|
||||
|
||||
return null;
|
||||
} // catch the terminating character
|
||||
|
||||
|
||||
if (character === term) {
|
||||
_fs().default.closeSync(fd);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (character === 127 || process.platform === 'win32' && character === 8) {
|
||||
// backspace
|
||||
if (!insert) {
|
||||
continue;
|
||||
}
|
||||
|
||||
str = str.slice(0, insert - 1) + str.slice(insert);
|
||||
insert--;
|
||||
process.stdout.write('\u001b[2D');
|
||||
} else {
|
||||
if (character < 32 || character > 126) {
|
||||
continue;
|
||||
}
|
||||
|
||||
str = str.slice(0, insert) + String.fromCharCode(character) + str.slice(insert);
|
||||
insert++;
|
||||
}
|
||||
|
||||
if (masked) {
|
||||
process.stdout.write(`\u001b[2K\u001b[0G${ask}${Array(str.length + 1).join(echo)}`);
|
||||
} else {
|
||||
process.stdout.write('\u001b[s');
|
||||
|
||||
if (insert === str.length) {
|
||||
process.stdout.write(`\u001b[2K\u001b[0G${ask}${str}`);
|
||||
} else if (ask) {
|
||||
process.stdout.write(`\u001b[2K\u001b[0G${ask}${str}`);
|
||||
} else {
|
||||
process.stdout.write(`\u001b[2K\u001b[0G${str}\u001b[${str.length - insert}D`);
|
||||
}
|
||||
|
||||
process.stdout.write('\u001b[u');
|
||||
process.stdout.write('\u001b[1C');
|
||||
}
|
||||
}
|
||||
|
||||
process.stdout.write('\n');
|
||||
|
||||
if (process.stdin.setRawMode) {
|
||||
process.stdin.setRawMode(!!wasRaw);
|
||||
}
|
||||
|
||||
return str || value || '';
|
||||
}
|
||||
}
|
||||
|
||||
var _default = create;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=promptSync.js.map
|
205
node_modules/@react-native-community/cli/build/tools/generator/templates.js
generated
vendored
Normal file
205
node_modules/@react-native-community/cli/build/tools/generator/templates.js
generated
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createProjectFromTemplate = createProjectFromTemplate;
|
||||
|
||||
function _child_process() {
|
||||
const data = require("child_process");
|
||||
|
||||
_child_process = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var _copyProjectTemplateAndReplace = _interopRequireDefault(require("./copyProjectTemplateAndReplace"));
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var PackageManager = _interopRequireWildcard(require("../packageManager"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param destPath Create the new project at this path.
|
||||
* @param newProjectName For example 'AwesomeApp'.
|
||||
* @param template Template to use, for example 'navigation'.
|
||||
*/
|
||||
async function createProjectFromTemplate(destPath, newProjectName, template) {
|
||||
const templatePath = _path().default.dirname(require.resolve('react-native/template'));
|
||||
|
||||
(0, _copyProjectTemplateAndReplace.default)(templatePath, destPath, newProjectName);
|
||||
|
||||
if (template === undefined) {
|
||||
// No specific template, use just the react-native template above
|
||||
return;
|
||||
} // Keep the files from the react-native template, and overwrite some of them
|
||||
// with the specified project template.
|
||||
// The react-native template contains the native files (these are used by
|
||||
// all templates) and every other template only contains additional JS code.
|
||||
// Reason:
|
||||
// This way we don't have to duplicate the native files in every template.
|
||||
// If we duplicated them we'd make RN larger and risk that people would
|
||||
// forget to maintain all the copies so they would go out of sync.
|
||||
|
||||
|
||||
await createFromRemoteTemplate(template, destPath, newProjectName);
|
||||
}
|
||||
/**
|
||||
* The following formats are supported for the template:
|
||||
* - 'demo' -> Fetch the package react-native-template-demo from npm
|
||||
* - git://..., http://..., file://... or any other URL supported by npm
|
||||
*/
|
||||
|
||||
|
||||
async function createFromRemoteTemplate(template, destPath, newProjectName) {
|
||||
let installPackage;
|
||||
let templateName;
|
||||
|
||||
if (template.includes(':/')) {
|
||||
// URL, e.g. git://, file://, file:/
|
||||
installPackage = template;
|
||||
templateName = template.substr(template.lastIndexOf('/') + 1);
|
||||
} else {
|
||||
// e.g 'demo'
|
||||
installPackage = `react-native-template-${template}`;
|
||||
templateName = installPackage;
|
||||
} // Check if the template exists
|
||||
|
||||
|
||||
_cliTools().logger.info(`Fetching template ${installPackage}...`);
|
||||
|
||||
try {
|
||||
await PackageManager.install([installPackage], {
|
||||
root: destPath
|
||||
});
|
||||
|
||||
const templatePath = _path().default.resolve('node_modules', templateName);
|
||||
|
||||
(0, _copyProjectTemplateAndReplace.default)(templatePath, destPath, newProjectName, {
|
||||
// Every template contains a dummy package.json file included
|
||||
// only for publishing the template to npm.
|
||||
// We want to ignore this dummy file, otherwise it would overwrite
|
||||
// our project's package.json file.
|
||||
ignorePaths: ['package.json', 'dependencies.json', 'devDependencies.json']
|
||||
});
|
||||
await installTemplateDependencies(templatePath, destPath);
|
||||
await installTemplateDevDependencies(templatePath, destPath);
|
||||
} finally {
|
||||
// Clean up the temp files
|
||||
try {
|
||||
await PackageManager.uninstall([templateName], {
|
||||
root: destPath
|
||||
});
|
||||
} catch (err) {
|
||||
// Not critical but we still want people to know and report
|
||||
// if this the clean up fails.
|
||||
_cliTools().logger.warn(`Failed to clean up template temp files in node_modules/${templateName}. ` + 'This is not a critical error, you can work on your app.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function installTemplateDependencies(templatePath, root) {
|
||||
// dependencies.json is a special file that lists additional dependencies
|
||||
// that are required by this template
|
||||
const dependenciesJsonPath = _path().default.resolve(templatePath, 'dependencies.json');
|
||||
|
||||
_cliTools().logger.info('Adding dependencies for the project...');
|
||||
|
||||
if (!_fs().default.existsSync(dependenciesJsonPath)) {
|
||||
_cliTools().logger.info('No additional dependencies.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let dependencies;
|
||||
|
||||
try {
|
||||
dependencies = require(dependenciesJsonPath);
|
||||
} catch (err) {
|
||||
throw new Error(`Could not parse the template's dependencies.json: ${err.message}`);
|
||||
}
|
||||
|
||||
const dependenciesToInstall = Object.keys(dependencies).map(depName => `${depName}@${dependencies[depName]}`);
|
||||
await PackageManager.install(dependenciesToInstall, {
|
||||
root
|
||||
});
|
||||
|
||||
_cliTools().logger.info("Linking native dependencies into the project's build files...");
|
||||
|
||||
(0, _child_process().execSync)('react-native link', {
|
||||
cwd: root,
|
||||
stdio: 'inherit'
|
||||
});
|
||||
}
|
||||
|
||||
async function installTemplateDevDependencies(templatePath, root) {
|
||||
// devDependencies.json is a special file that lists additional develop dependencies
|
||||
// that are required by this template
|
||||
const devDependenciesJsonPath = _path().default.resolve(templatePath, 'devDependencies.json');
|
||||
|
||||
_cliTools().logger.info('Adding develop dependencies for the project...');
|
||||
|
||||
if (!_fs().default.existsSync(devDependenciesJsonPath)) {
|
||||
_cliTools().logger.info('No additional develop dependencies.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let dependencies;
|
||||
|
||||
try {
|
||||
dependencies = require(devDependenciesJsonPath);
|
||||
} catch (err) {
|
||||
throw new Error(`Could not parse the template's devDependencies.json: ${err.message}`);
|
||||
}
|
||||
|
||||
const dependenciesToInstall = Object.keys(dependencies).map(depName => `${depName}@${dependencies[depName]}`);
|
||||
await PackageManager.installDev(dependenciesToInstall, {
|
||||
root
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=templates.js.map
|
36
node_modules/@react-native-community/cli/build/tools/gracefulifyFs.js
generated
vendored
Normal file
36
node_modules/@react-native-community/cli/build/tools/gracefulifyFs.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _gracefulFs() {
|
||||
const data = _interopRequireDefault(require("graceful-fs"));
|
||||
|
||||
_gracefulFs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
_gracefulFs().default.gracefulify(_fs().default);
|
||||
|
||||
var _default = _gracefulFs().default;
|
||||
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=gracefulifyFs.js.map
|
25
node_modules/@react-native-community/cli/build/tools/hookStdout.js
generated
vendored
Normal file
25
node_modules/@react-native-community/cli/build/tools/hookStdout.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
// https://gist.github.com/pguillory/729616
|
||||
function hookStdout(callback) {
|
||||
let old_write = process.stdout.write; // @ts-ignore
|
||||
|
||||
process.stdout.write = (write => function (str) {
|
||||
write.apply(process.stdout, arguments);
|
||||
callback(str);
|
||||
})(process.stdout.write);
|
||||
|
||||
return () => {
|
||||
process.stdout.write = old_write;
|
||||
};
|
||||
}
|
||||
|
||||
var _default = hookStdout;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=hookStdout.js.map
|
40
node_modules/@react-native-community/cli/build/tools/install.js
generated
vendored
Normal file
40
node_modules/@react-native-community/cli/build/tools/install.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.install = install;
|
||||
|
||||
var _brewInstall = require("./brewInstall");
|
||||
|
||||
var _common = require("../commands/doctor/healthchecks/common");
|
||||
|
||||
async function install({
|
||||
pkg,
|
||||
label,
|
||||
url,
|
||||
loader
|
||||
}) {
|
||||
try {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
await (0, _brewInstall.brewInstall)({
|
||||
pkg,
|
||||
label,
|
||||
loader
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Not implemented yet');
|
||||
}
|
||||
} catch (_error) {
|
||||
loader.fail();
|
||||
(0, _common.logManualInstallation)({
|
||||
healthcheck: label,
|
||||
url
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=install.js.map
|
233
node_modules/@react-native-community/cli/build/tools/installPods.js
generated
vendored
Normal file
233
node_modules/@react-native-community/cli/build/tools/installPods.js
generated
vendored
Normal file
@ -0,0 +1,233 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.promptCocoaPodsInstallationQuestion = promptCocoaPodsInstallationQuestion;
|
||||
exports.runSudo = runSudo;
|
||||
exports.installCocoaPods = installCocoaPods;
|
||||
exports.default = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = 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 _inquirer() {
|
||||
const data = _interopRequireDefault(require("inquirer"));
|
||||
|
||||
_inquirer = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _cliTools() {
|
||||
const data = require("@react-native-community/cli-tools");
|
||||
|
||||
_cliTools = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _loader = require("./loader");
|
||||
|
||||
function _sudoPrompt() {
|
||||
const data = _interopRequireDefault(require("sudo-prompt"));
|
||||
|
||||
_sudoPrompt = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _brewInstall = require("./brewInstall");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @ts-ignore untyped
|
||||
// @ts-ignore untyped
|
||||
async function runPodInstall(loader, projectName, shouldHandleRepoUpdate = true) {
|
||||
try {
|
||||
loader.start(`Installing CocoaPods dependencies ${_chalk().default.dim('(this may take a few minutes)')}`);
|
||||
await (0, _execa().default)('pod', ['install']);
|
||||
} catch (error) {
|
||||
// "pod" command outputs errors to stdout (at least some of them)
|
||||
const stderr = error.stderr || error.stdout;
|
||||
/**
|
||||
* If CocoaPods failed due to repo being out of date, it will
|
||||
* include the update command in the error message.
|
||||
*
|
||||
* `shouldHandleRepoUpdate` will be set to `false` to
|
||||
* prevent infinite loop (unlikely scenario)
|
||||
*/
|
||||
|
||||
if (stderr.includes('pod repo update') && shouldHandleRepoUpdate) {
|
||||
await runPodUpdate(loader);
|
||||
await runPodInstall(loader, projectName, false);
|
||||
} else {
|
||||
loader.fail();
|
||||
throw new Error(`Failed to install CocoaPods dependencies for iOS project, which is required by this template.\nPlease try again manually: "cd ./${projectName}/ios && pod install".\nCocoaPods documentation: ${_chalk().default.dim.underline('https://cocoapods.org/')}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function runPodUpdate(loader) {
|
||||
try {
|
||||
loader.start(`Updating CocoaPods repositories ${_chalk().default.dim('(this may take a few minutes)')}`);
|
||||
await (0, _execa().default)('pod', ['repo', 'update']);
|
||||
} catch (error) {
|
||||
// "pod" command outputs errors to stdout (at least some of them)
|
||||
_cliTools().logger.log(error.stderr || error.stdout);
|
||||
|
||||
loader.fail();
|
||||
throw new Error(`Failed to update CocoaPods repositories for iOS project.\nPlease try again manually: "pod repo update".\nCocoaPods documentation: ${_chalk().default.dim.underline('https://cocoapods.org/')}`);
|
||||
}
|
||||
}
|
||||
|
||||
function runSudo(command) {
|
||||
return new Promise((resolve, reject) => {
|
||||
_sudoPrompt().default.exec(command, {
|
||||
name: 'React Native CLI'
|
||||
}, error => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function promptCocoaPodsInstallationQuestion() {
|
||||
const promptQuestion = `CocoaPods ${_chalk().default.dim.underline('(https://cocoapods.org/)')} ${_chalk().default.reset.bold('is not installed. CocoaPods is necessary for the iOS project to run correctly. Do you want to install it?')}`;
|
||||
const installWithGem = 'Yes, with gem (may require sudo)';
|
||||
const installWithHomebrew = 'Yes, with Homebrew';
|
||||
const {
|
||||
shouldInstallCocoaPods
|
||||
} = await _inquirer().default.prompt([{
|
||||
type: 'list',
|
||||
name: 'shouldInstallCocoaPods',
|
||||
message: promptQuestion,
|
||||
choices: [installWithGem, installWithHomebrew]
|
||||
}]);
|
||||
const shouldInstallWithGem = shouldInstallCocoaPods === installWithGem;
|
||||
return {
|
||||
installMethod: shouldInstallWithGem ? 'gem' : 'homebrew',
|
||||
// This is used for removing the message in `doctor` after it's answered
|
||||
promptQuestion: `? ${promptQuestion} ${shouldInstallWithGem ? installWithGem : installWithHomebrew}`
|
||||
};
|
||||
}
|
||||
|
||||
async function installCocoaPodsWithGem() {
|
||||
const options = ['install', 'cocoapods', '--no-document'];
|
||||
|
||||
try {
|
||||
// First attempt to install `cocoapods`
|
||||
await (0, _execa().default)('gem', options);
|
||||
} catch (_error) {
|
||||
// If that doesn't work then try with sudo
|
||||
await runSudo(`gem ${options.join(' ')}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function installCocoaPods(loader) {
|
||||
loader.stop();
|
||||
const {
|
||||
installMethod
|
||||
} = await promptCocoaPodsInstallationQuestion();
|
||||
|
||||
if (installMethod === 'gem') {
|
||||
loader.start('Installing CocoaPods');
|
||||
|
||||
try {
|
||||
await installCocoaPodsWithGem();
|
||||
return loader.succeed();
|
||||
} catch (error) {
|
||||
loader.fail();
|
||||
|
||||
_cliTools().logger.error(error.stderr);
|
||||
|
||||
throw new Error(`An error occured while trying to install CocoaPods, which is required by this template.\nPlease try again manually: sudo gem install cocoapods.\nCocoaPods documentation: ${_chalk().default.dim.underline('https://cocoapods.org/')}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (installMethod === 'homebrew') {
|
||||
return await (0, _brewInstall.brewInstall)({
|
||||
pkg: 'cocoapods',
|
||||
label: 'Installing CocoaPods',
|
||||
loader
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function installPods({
|
||||
projectName,
|
||||
loader
|
||||
}) {
|
||||
loader = loader || new _loader.NoopLoader();
|
||||
|
||||
try {
|
||||
if (!_fs().default.existsSync('ios')) {
|
||||
return;
|
||||
}
|
||||
|
||||
process.chdir('ios');
|
||||
|
||||
const hasPods = _fs().default.existsSync('Podfile');
|
||||
|
||||
if (!hasPods) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Check if "pod" is available and usable. It happens that there are
|
||||
// multiple versions of "pod" command and even though it's there, it exits
|
||||
// with a failure
|
||||
await (0, _execa().default)('pod', ['--version']);
|
||||
} catch (e) {
|
||||
loader.info();
|
||||
await installCocoaPods(loader);
|
||||
}
|
||||
|
||||
await runPodInstall(loader, projectName);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} finally {
|
||||
process.chdir('..');
|
||||
}
|
||||
}
|
||||
|
||||
var _default = installPods;
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=installPods.js.map
|
99
node_modules/@react-native-community/cli/build/tools/loadMetroConfig.js
generated
vendored
Normal file
99
node_modules/@react-native-community/cli/build/tools/loadMetroConfig.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = load;
|
||||
exports.getDefaultConfig = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _metroConfig() {
|
||||
const data = require("metro-config");
|
||||
|
||||
_metroConfig = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _metroPlatformResolver = require("./metroPlatformResolver");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Configuration file of Metro.
|
||||
*/
|
||||
// @ts-ignore - no typed definition for the package
|
||||
const INTERNAL_CALLSITES_REGEX = new RegExp(['/Libraries/Renderer/implementations/.+\\.js$', '/Libraries/BatchedBridge/MessageQueue\\.js$', '/Libraries/YellowBox/.+\\.js$', '/Libraries/LogBox/.+\\.js$', '/Libraries/Core/Timers/.+\\.js$', '/node_modules/react-devtools-core/.+\\.js$', '/node_modules/react-refresh/.+\\.js$', '/node_modules/scheduler/.+\\.js$'].join('|'));
|
||||
|
||||
/**
|
||||
* Default configuration
|
||||
*/
|
||||
const getDefaultConfig = ctx => {
|
||||
const outOfTreePlatforms = Object.keys(ctx.platforms).filter(platform => ctx.platforms[platform].npmPackageName);
|
||||
return {
|
||||
resolver: {
|
||||
resolveRequest: outOfTreePlatforms.length === 0 ? undefined : (0, _metroPlatformResolver.reactNativePlatformResolver)(outOfTreePlatforms.reduce((result, platform) => {
|
||||
result[platform] = ctx.platforms[platform].npmPackageName;
|
||||
return result;
|
||||
}, {})),
|
||||
resolverMainFields: ['react-native', 'browser', 'main'],
|
||||
platforms: [...Object.keys(ctx.platforms), 'native']
|
||||
},
|
||||
serializer: {
|
||||
// We can include multiple copies of InitializeCore here because metro will
|
||||
// only add ones that are already part of the bundle
|
||||
getModulesRunBeforeMainModule: () => [require.resolve(_path().default.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore')), ...outOfTreePlatforms.map(platform => require.resolve(`${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`))],
|
||||
getPolyfills: () => require(_path().default.join(ctx.reactNativePath, 'rn-get-polyfills'))()
|
||||
},
|
||||
server: {
|
||||
port: Number(process.env.RCT_METRO_PORT) || 8081
|
||||
},
|
||||
symbolicator: {
|
||||
customizeFrame: frame => {
|
||||
const collapse = Boolean(frame.file && INTERNAL_CALLSITES_REGEX.test(frame.file));
|
||||
return {
|
||||
collapse
|
||||
};
|
||||
}
|
||||
},
|
||||
transformer: {
|
||||
allowOptionalDependencies: true,
|
||||
babelTransformerPath: require.resolve('metro-react-native-babel-transformer'),
|
||||
assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry'
|
||||
},
|
||||
watchFolders: []
|
||||
};
|
||||
};
|
||||
|
||||
exports.getDefaultConfig = getDefaultConfig;
|
||||
|
||||
/**
|
||||
* Loads Metro Config and applies `options` on top of the resolved config.
|
||||
*
|
||||
* This allows the CLI to always overwrite the file settings.
|
||||
*/
|
||||
function load(ctx, options) {
|
||||
const defaultConfig = getDefaultConfig(ctx);
|
||||
|
||||
if (options && options.reporter) {
|
||||
defaultConfig.reporter = options.reporter;
|
||||
}
|
||||
|
||||
return (0, _metroConfig().loadConfig)({
|
||||
cwd: ctx.root,
|
||||
...options
|
||||
}, defaultConfig);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=loadMetroConfig.js.map
|
101
node_modules/@react-native-community/cli/build/tools/loader.js
generated
vendored
Normal file
101
node_modules/@react-native-community/cli/build/tools/loader.js
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getLoader = getLoader;
|
||||
exports.NoopLoader = void 0;
|
||||
|
||||
function _ora() {
|
||||
const data = _interopRequireDefault(require("ora"));
|
||||
|
||||
_ora = 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 }; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
class OraNoop {
|
||||
constructor() {
|
||||
_defineProperty(this, "spinner", {
|
||||
interval: 1,
|
||||
frames: []
|
||||
});
|
||||
|
||||
_defineProperty(this, "indent", 0);
|
||||
|
||||
_defineProperty(this, "isSpinning", false);
|
||||
|
||||
_defineProperty(this, "text", '');
|
||||
|
||||
_defineProperty(this, "prefixText", '');
|
||||
|
||||
_defineProperty(this, "color", 'blue');
|
||||
}
|
||||
|
||||
succeed(_text) {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
fail(_text) {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
start(_text) {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
stop() {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
warn(_text) {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
info(_text) {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
stopAndPersist() {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
clear() {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
frame() {
|
||||
return (0, _ora().default)();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getLoader() {
|
||||
// FIXME refactor getLoader to not rely on class instantiation to avoid type conflict or implement an default Ora Loader Class definition
|
||||
return _cliTools().logger.isVerbose() ? OraNoop : _ora().default;
|
||||
}
|
||||
|
||||
const NoopLoader = OraNoop;
|
||||
exports.NoopLoader = NoopLoader;
|
||||
|
||||
//# sourceMappingURL=loader.js.map
|
30
node_modules/@react-native-community/cli/build/tools/merge.js
generated
vendored
Normal file
30
node_modules/@react-native-community/cli/build/tools/merge.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = merge;
|
||||
|
||||
function _deepmerge() {
|
||||
const data = _interopRequireDefault(require("deepmerge"));
|
||||
|
||||
_deepmerge = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* `deepmerge` concatenates arrays by default instead of overwriting them.
|
||||
* We define custom merging function for arrays to change that behaviour
|
||||
*/
|
||||
function merge(x, y) {
|
||||
return (0, _deepmerge().default)(x, y, {
|
||||
arrayMerge: (_destinationArray, sourceArray) => sourceArray
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=merge.js.map
|
59
node_modules/@react-native-community/cli/build/tools/metroPlatformResolver.js
generated
vendored
Normal file
59
node_modules/@react-native-community/cli/build/tools/metroPlatformResolver.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.reactNativePlatformResolver = reactNativePlatformResolver;
|
||||
|
||||
function _metroResolver() {
|
||||
const data = require("metro-resolver");
|
||||
|
||||
_metroResolver = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an implementation of a metro resolveRequest option which will remap react-native imports
|
||||
* to different npm packages based on the platform requested. This allows a single metro instance/config
|
||||
* to produce bundles for multiple out of tree platforms at a time.
|
||||
*
|
||||
* @param platformImplementations
|
||||
* A map of platform to npm package that implements that platform
|
||||
*
|
||||
* Ex:
|
||||
* {
|
||||
* windows: 'react-native-windows'
|
||||
* macos: 'react-native-macos'
|
||||
* }
|
||||
*/
|
||||
// @ts-ignore - no typed definition for the package
|
||||
function reactNativePlatformResolver(platformImplementations) {
|
||||
return (context, _realModuleName, platform, moduleName) => {
|
||||
let backupResolveRequest = context.resolveRequest;
|
||||
delete context.resolveRequest;
|
||||
|
||||
try {
|
||||
let modifiedModuleName = moduleName;
|
||||
|
||||
if (platformImplementations[platform]) {
|
||||
if (moduleName === 'react-native') {
|
||||
modifiedModuleName = platformImplementations[platform];
|
||||
} else if (moduleName.startsWith('react-native/')) {
|
||||
modifiedModuleName = `${platformImplementations[platform]}/${modifiedModuleName.slice('react-native/'.length)}`;
|
||||
}
|
||||
}
|
||||
|
||||
let result = (0, _metroResolver().resolve)(context, modifiedModuleName, platform);
|
||||
return result;
|
||||
} catch (e) {
|
||||
throw e;
|
||||
} finally {
|
||||
context.resolveRequest = backupResolveRequest;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=metroPlatformResolver.js.map
|
95
node_modules/@react-native-community/cli/build/tools/packageManager.js
generated
vendored
Normal file
95
node_modules/@react-native-community/cli/build/tools/packageManager.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.init = init;
|
||||
exports.install = install;
|
||||
exports.installDev = installDev;
|
||||
exports.uninstall = uninstall;
|
||||
exports.installAll = installAll;
|
||||
|
||||
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 _yarn = require("./yarn");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const packageManagers = {
|
||||
yarn: {
|
||||
init: ['init', '-y'],
|
||||
install: ['add'],
|
||||
installDev: ['add', '-D'],
|
||||
uninstall: ['remove'],
|
||||
installAll: ['install']
|
||||
},
|
||||
npm: {
|
||||
init: ['init', '-y'],
|
||||
install: ['install', '--save', '--save-exact'],
|
||||
installDev: ['install', '--save-dev', '--save-exact'],
|
||||
uninstall: ['uninstall', '--save'],
|
||||
installAll: ['install']
|
||||
}
|
||||
};
|
||||
|
||||
function configurePackageManager(packageNames, action, options) {
|
||||
const pm = shouldUseYarn(options) ? 'yarn' : 'npm';
|
||||
const [executable, ...flags] = packageManagers[pm][action];
|
||||
const args = [executable, ...flags, ...packageNames];
|
||||
return executeCommand(pm, args, options);
|
||||
}
|
||||
|
||||
function executeCommand(command, args, options) {
|
||||
return (0, _execa().default)(command, args, {
|
||||
stdio: options.silent && !_cliTools().logger.isVerbose() ? 'pipe' : 'inherit',
|
||||
cwd: options.root
|
||||
});
|
||||
}
|
||||
|
||||
function shouldUseYarn(options) {
|
||||
if (options && options.preferYarn !== undefined) {
|
||||
return options.preferYarn && (0, _yarn.getYarnVersionIfAvailable)();
|
||||
}
|
||||
|
||||
return (0, _yarn.isProjectUsingYarn)(options.root) && (0, _yarn.getYarnVersionIfAvailable)();
|
||||
}
|
||||
|
||||
function init(options) {
|
||||
return configurePackageManager([], 'init', options);
|
||||
}
|
||||
|
||||
function install(packageNames, options) {
|
||||
return configurePackageManager(packageNames, 'install', options);
|
||||
}
|
||||
|
||||
function installDev(packageNames, options) {
|
||||
return configurePackageManager(packageNames, 'installDev', options);
|
||||
}
|
||||
|
||||
function uninstall(packageNames, options) {
|
||||
return configurePackageManager(packageNames, 'uninstall', options);
|
||||
}
|
||||
|
||||
function installAll(options) {
|
||||
return configurePackageManager([], 'installAll', options);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=packageManager.js.map
|
144
node_modules/@react-native-community/cli/build/tools/releaseChecker/getLatestRelease.js
generated
vendored
Normal file
144
node_modules/@react-native-community/cli/build/tools/releaseChecker/getLatestRelease.js
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getLatestRelease;
|
||||
|
||||
function _semver() {
|
||||
const data = _interopRequireDefault(require("semver"));
|
||||
|
||||
_semver = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _releaseCacheManager = _interopRequireDefault(require("./releaseCacheManager"));
|
||||
|
||||
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 }; }
|
||||
|
||||
/**
|
||||
* Checks via GitHub API if there is a newer stable React Native release and,
|
||||
* if it exists, returns the release data.
|
||||
*
|
||||
* If the latest release is not newer or if it's a prerelease, the function
|
||||
* will return undefined.
|
||||
*/
|
||||
async function getLatestRelease(name, currentVersion) {
|
||||
_cliTools().logger.debug('Checking for a newer version of React Native');
|
||||
|
||||
try {
|
||||
_cliTools().logger.debug(`Current version: ${currentVersion}`);
|
||||
|
||||
const cachedLatest = _releaseCacheManager.default.get(name, 'latestVersion');
|
||||
|
||||
if (cachedLatest) {
|
||||
_cliTools().logger.debug(`Cached release version: ${cachedLatest}`);
|
||||
}
|
||||
|
||||
const aWeek = 7 * 24 * 60 * 60 * 1000;
|
||||
|
||||
const lastChecked = _releaseCacheManager.default.get(name, 'lastChecked');
|
||||
|
||||
const now = new Date();
|
||||
|
||||
if (lastChecked && Number(now) - Number(new Date(lastChecked)) < aWeek) {
|
||||
_cliTools().logger.debug('Cached release is still recent, skipping remote check');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_cliTools().logger.debug('Checking for newer releases on GitHub');
|
||||
|
||||
const eTag = _releaseCacheManager.default.get(name, 'eTag');
|
||||
|
||||
const latestVersion = await getLatestRnDiffPurgeVersion(name, eTag);
|
||||
|
||||
_cliTools().logger.debug(`Latest release: ${latestVersion}`);
|
||||
|
||||
if (_semver().default.compare(latestVersion, currentVersion) === 1 && !_semver().default.prerelease(latestVersion)) {
|
||||
return {
|
||||
version: latestVersion,
|
||||
changelogUrl: buildChangelogUrl(latestVersion),
|
||||
diffUrl: buildDiffUrl(currentVersion)
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
_cliTools().logger.debug('Something went wrong with remote version checking, moving on');
|
||||
|
||||
_cliTools().logger.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
function buildChangelogUrl(version) {
|
||||
return `https://github.com/facebook/react-native/releases/tag/v${version}`;
|
||||
}
|
||||
|
||||
function buildDiffUrl(version) {
|
||||
return `https://react-native-community.github.io/upgrade-helper/?from=${version}`;
|
||||
}
|
||||
/**
|
||||
* Returns the most recent React Native version available to upgrade to.
|
||||
*/
|
||||
|
||||
|
||||
async function getLatestRnDiffPurgeVersion(name, eTag) {
|
||||
const options = {
|
||||
// https://developer.github.com/v3/#user-agent-required
|
||||
headers: {
|
||||
'User-Agent': 'React-Native-CLI'
|
||||
}
|
||||
};
|
||||
|
||||
if (eTag) {
|
||||
options.headers['If-None-Match'] = eTag;
|
||||
}
|
||||
|
||||
const {
|
||||
data,
|
||||
status,
|
||||
headers
|
||||
} = await (0, _cliTools().fetch)('https://api.github.com/repos/react-native-community/rn-diff-purge/tags', options); // Remote is newer.
|
||||
|
||||
if (status === 200) {
|
||||
const body = data;
|
||||
const latestVersion = body[0].name.substring(8);
|
||||
const eTagHeader = headers.get('eTag'); // Update cache only if newer release is stable.
|
||||
|
||||
if (!_semver().default.prerelease(latestVersion) && eTagHeader) {
|
||||
_cliTools().logger.debug(`Saving ${eTagHeader} to cache`);
|
||||
|
||||
_releaseCacheManager.default.set(name, 'eTag', eTagHeader);
|
||||
|
||||
_releaseCacheManager.default.set(name, 'latestVersion', latestVersion);
|
||||
}
|
||||
|
||||
return latestVersion;
|
||||
} // Cache is still valid.
|
||||
|
||||
|
||||
if (status === 304) {
|
||||
const latestVersion = _releaseCacheManager.default.get(name, 'latestVersion');
|
||||
|
||||
if (latestVersion) {
|
||||
return latestVersion;
|
||||
}
|
||||
} // Should be returned only if something went wrong.
|
||||
|
||||
|
||||
return '0.0.0';
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getLatestRelease.js.map
|
61
node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
generated
vendored
Normal file
61
node_modules/@react-native-community/cli/build/tools/releaseChecker/index.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = releaseChecker;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
var _resolveNodeModuleDir = _interopRequireDefault(require("../config/resolveNodeModuleDir"));
|
||||
|
||||
var _getLatestRelease = _interopRequireDefault(require("./getLatestRelease"));
|
||||
|
||||
var _printNewRelease = _interopRequireDefault(require("./printNewRelease"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
// @ts-ignore - JS file
|
||||
async function releaseChecker(root) {
|
||||
try {
|
||||
const {
|
||||
version: currentVersion
|
||||
} = require(_path().default.join((0, _resolveNodeModuleDir.default)(root, 'react-native'), 'package.json'));
|
||||
|
||||
const {
|
||||
name
|
||||
} = require(_path().default.join(root, 'package.json'));
|
||||
|
||||
const latestRelease = await (0, _getLatestRelease.default)(name, currentVersion);
|
||||
|
||||
if (latestRelease) {
|
||||
(0, _printNewRelease.default)(name, latestRelease, currentVersion);
|
||||
}
|
||||
} catch (e) {
|
||||
// We let the flow continue as this component is not vital for the rest of
|
||||
// the CLI.
|
||||
_cliTools().logger.debug('Cannot detect current version of React Native, ' + 'skipping check for a newer release');
|
||||
|
||||
_cliTools().logger.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
47
node_modules/@react-native-community/cli/build/tools/releaseChecker/printNewRelease.js
generated
vendored
Normal file
47
node_modules/@react-native-community/cli/build/tools/releaseChecker/printNewRelease.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = printNewRelease;
|
||||
|
||||
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 _releaseCacheManager = _interopRequireDefault(require("./releaseCacheManager"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Notifies the user that a newer version of React Native is available.
|
||||
*/
|
||||
function printNewRelease(name, latestRelease, currentVersion) {
|
||||
_cliTools().logger.info(`React Native v${latestRelease.version} is now available (your project is running on v${currentVersion}).`);
|
||||
|
||||
_cliTools().logger.info(`Changelog: ${_chalk().default.dim.underline(latestRelease.changelogUrl)}.`);
|
||||
|
||||
_cliTools().logger.info(`Diff: ${_chalk().default.dim.underline(latestRelease.diffUrl)}.`);
|
||||
|
||||
_cliTools().logger.info(`To upgrade, run "${_chalk().default.bold('react-native upgrade')}".`);
|
||||
|
||||
_releaseCacheManager.default.set(name, 'lastChecked', new Date().toISOString());
|
||||
}
|
||||
|
||||
//# sourceMappingURL=printNewRelease.js.map
|
123
node_modules/@react-native-community/cli/build/tools/releaseChecker/releaseCacheManager.js
generated
vendored
Normal file
123
node_modules/@react-native-community/cli/build/tools/releaseChecker/releaseCacheManager.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
"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 _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _os() {
|
||||
const data = _interopRequireDefault(require("os"));
|
||||
|
||||
_os = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _mkdirp() {
|
||||
const data = _interopRequireDefault(require("mkdirp"));
|
||||
|
||||
_mkdirp = 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 }; }
|
||||
|
||||
function loadCache(name) {
|
||||
try {
|
||||
const cacheRaw = _fs().default.readFileSync(_path().default.resolve(getCacheRootPath(), name), 'utf8');
|
||||
|
||||
const cache = JSON.parse(cacheRaw);
|
||||
return cache;
|
||||
} catch (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
// Create cache file since it doesn't exist.
|
||||
saveCache(name, {});
|
||||
}
|
||||
|
||||
_cliTools().logger.debug('No release cache found');
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function saveCache(name, cache) {
|
||||
_fs().default.writeFileSync(_path().default.resolve(getCacheRootPath(), name), JSON.stringify(cache, null, 2));
|
||||
}
|
||||
/**
|
||||
* Returns the path string of `$HOME/.react-native-cli`.
|
||||
*
|
||||
* In case it doesn't exist, it will be created.
|
||||
*/
|
||||
|
||||
|
||||
function getCacheRootPath() {
|
||||
const cachePath = _path().default.resolve(_os().default.homedir(), '.react-native-cli', 'cache');
|
||||
|
||||
if (!_fs().default.existsSync(cachePath)) {
|
||||
_mkdirp().default.sync(cachePath);
|
||||
}
|
||||
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
function get(name, key) {
|
||||
const cache = loadCache(name);
|
||||
|
||||
if (cache) {
|
||||
return cache[key];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function set(name, key, value) {
|
||||
const cache = loadCache(name);
|
||||
|
||||
if (cache) {
|
||||
cache[key] = value;
|
||||
saveCache(name, cache);
|
||||
}
|
||||
}
|
||||
|
||||
var _default = {
|
||||
get,
|
||||
set
|
||||
};
|
||||
exports.default = _default;
|
||||
|
||||
//# sourceMappingURL=releaseCacheManager.js.map
|
28
node_modules/@react-native-community/cli/build/tools/replacePathSepForRegex.js
generated
vendored
Normal file
28
node_modules/@react-native-community/cli/build/tools/replacePathSepForRegex.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = replacePathSepForRegex;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function replacePathSepForRegex(string) {
|
||||
if (_path().default.sep === '\\') {
|
||||
return string.replace(/(\/|(.)?\\(?![[\]{}()*+?.^$|\\]))/g, (_match, _, p2) => p2 && p2 !== '\\' ? p2 + '\\\\' : '\\\\');
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=replacePathSepForRegex.js.map
|
43
node_modules/@react-native-community/cli/build/tools/unzip.js
generated
vendored
Normal file
43
node_modules/@react-native-community/cli/build/tools/unzip.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.unzip = void 0;
|
||||
|
||||
function _fsExtra() {
|
||||
const data = require("fs-extra");
|
||||
|
||||
_fsExtra = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const StreamZip = require('node-stream-zip');
|
||||
|
||||
const unzip = async (source, destination) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const zip = new StreamZip({
|
||||
file: source,
|
||||
storeEntries: true
|
||||
});
|
||||
(0, _fsExtra().mkdirpSync)(destination);
|
||||
zip.on('ready', () => {
|
||||
zip.extract(null, destination, err => {
|
||||
zip.close();
|
||||
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.unzip = unzip;
|
||||
|
||||
//# sourceMappingURL=unzip.js.map
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user