@react-native/community-cli-plugin 0.73.0 → 0.73.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/commands/bundle/assetCatalogIOS.js.flow +9 -57
- package/dist/commands/bundle/assetPathUtils.js.flow +12 -66
- package/dist/commands/bundle/buildBundle.js +16 -7
- package/dist/commands/bundle/buildBundle.js.flow +39 -95
- package/dist/commands/bundle/filterPlatformAssetScales.js.flow +5 -33
- package/dist/commands/bundle/getAssetDestPathAndroid.js.flow +7 -14
- package/dist/commands/bundle/getAssetDestPathIOS.js.flow +7 -16
- package/dist/commands/bundle/index.js +124 -0
- package/dist/commands/bundle/index.js.flow +18 -0
- package/dist/commands/bundle/saveAssets.js +1 -1
- package/dist/commands/bundle/saveAssets.js.flow +6 -124
- package/dist/commands/{bundle/ramBundle.js → ram-bundle/index.js} +17 -19
- package/dist/commands/ram-bundle/index.js.flow +15 -0
- package/dist/commands/start/attachKeyHandlers.js +109 -0
- package/dist/commands/start/attachKeyHandlers.js.flow +22 -0
- package/dist/commands/start/index.js +3 -8
- package/dist/commands/start/index.js.flow +6 -85
- package/dist/commands/start/runServer.js +82 -32
- package/dist/commands/start/runServer.js.flow +9 -127
- package/dist/index.flow.js +2 -2
- package/dist/index.flow.js.flow +5 -5
- package/dist/index.js.flow +1 -9
- package/dist/utils/KeyPressHandler.js +91 -0
- package/dist/utils/KeyPressHandler.js.flow +22 -0
- package/dist/utils/isDevServerRunning.js +74 -0
- package/dist/utils/isDevServerRunning.js.flow +27 -0
- package/dist/utils/loadMetroConfig.js +6 -7
- package/dist/utils/loadMetroConfig.js.flow +10 -102
- package/dist/utils/metroPlatformResolver.js.flow +4 -18
- package/package.json +11 -9
- package/dist/commands/bundle/bundle.js +0 -44
- package/dist/commands/bundle/bundle.js.flow +0 -37
- package/dist/commands/bundle/bundleCommandLineArgs.js +0 -116
- package/dist/commands/bundle/bundleCommandLineArgs.js.flow +0 -129
- package/dist/commands/bundle/ramBundle.js.flow +0 -43
- package/dist/commands/start/startServerInNewWindow.js +0 -132
- package/dist/commands/start/startServerInNewWindow.js.flow +0 -125
- package/dist/commands/start/watchMode.js +0 -95
- package/dist/commands/start/watchMode.js.flow +0 -101
- package/launchPackager.bat +0 -7
- package/launchPackager.command +0 -10
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true,
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _readline = _interopRequireDefault(require("readline"));
|
|
8
|
-
var _cliTools = require("@react-native-community/cli-tools");
|
|
9
|
-
var _execa = _interopRequireDefault(require("execa"));
|
|
10
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
-
function _interopRequireDefault(obj) {
|
|
12
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @format
|
|
22
|
-
* @oncall react_native
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
function printWatchModeInstructions() {
|
|
26
|
-
_cliTools.logger.log(
|
|
27
|
-
`${_chalk.default.bold("r")} - reload the app\n${_chalk.default.bold(
|
|
28
|
-
"d"
|
|
29
|
-
)} - open developer menu\n${_chalk.default.bold(
|
|
30
|
-
"i"
|
|
31
|
-
)} - run on iOS\n${_chalk.default.bold("a")} - run on Android`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
function enableWatchMode(messageSocket, ctx) {
|
|
35
|
-
// We need to set this to true to catch key presses individually.
|
|
36
|
-
// As a result we have to implement our own method for exiting
|
|
37
|
-
// and other commands (e.g. ctrl+c & ctrl+z)
|
|
38
|
-
// $FlowIgnore[method-unbinding]
|
|
39
|
-
if (!process.stdin.setRawMode) {
|
|
40
|
-
_cliTools.logger.debug("Watch mode is not supported in this environment");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
_readline.default.emitKeypressEvents(process.stdin);
|
|
44
|
-
|
|
45
|
-
// $FlowIgnore[prop-missing]
|
|
46
|
-
process.stdin.setRawMode(true);
|
|
47
|
-
|
|
48
|
-
// We have no way of knowing when the dependency graph is done loading
|
|
49
|
-
// except by hooking into stdout itself. We want to print instructions
|
|
50
|
-
// right after its done loading.
|
|
51
|
-
const restore = (0, _cliTools.hookStdout)((output) => {
|
|
52
|
-
// TODO(T160391951) Replace this string check with a suitable integration point
|
|
53
|
-
// in Metro
|
|
54
|
-
if (output.includes("Fast - Scalable - Integrated")) {
|
|
55
|
-
printWatchModeInstructions();
|
|
56
|
-
restore();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
process.stdin.on("keypress", (_key, data) => {
|
|
60
|
-
const { ctrl, name } = data;
|
|
61
|
-
if (ctrl === true) {
|
|
62
|
-
switch (name) {
|
|
63
|
-
case "c":
|
|
64
|
-
process.exit();
|
|
65
|
-
break;
|
|
66
|
-
case "z":
|
|
67
|
-
process.emit("SIGTSTP", "SIGTSTP");
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
} else if (name === "r") {
|
|
71
|
-
messageSocket.broadcast("reload", null);
|
|
72
|
-
_cliTools.logger.info("Reloading app...");
|
|
73
|
-
} else if (name === "d") {
|
|
74
|
-
messageSocket.broadcast("devMenu", null);
|
|
75
|
-
_cliTools.logger.info("Opening developer menu...");
|
|
76
|
-
} else if (name === "i" || name === "a") {
|
|
77
|
-
_cliTools.logger.info(
|
|
78
|
-
`Opening the app on ${name === "i" ? "iOS" : "Android"}...`
|
|
79
|
-
);
|
|
80
|
-
const params =
|
|
81
|
-
name === "i"
|
|
82
|
-
? ctx.project.ios?.watchModeCommandParams
|
|
83
|
-
: ctx.project.android?.watchModeCommandParams;
|
|
84
|
-
(0, _execa.default)("npx", [
|
|
85
|
-
"react-native",
|
|
86
|
-
name === "i" ? "run-ios" : "run-android",
|
|
87
|
-
...(params ?? []),
|
|
88
|
-
]).stdout?.pipe(process.stdout);
|
|
89
|
-
} else {
|
|
90
|
-
console.log(_key);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
var _default = enableWatchMode;
|
|
95
|
-
exports.default = _default;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @flow
|
|
8
|
-
* @format
|
|
9
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import type {Config} from '@react-native-community/cli-types';
|
|
13
|
-
|
|
14
|
-
import readline from 'readline';
|
|
15
|
-
import {logger, hookStdout} from '@react-native-community/cli-tools';
|
|
16
|
-
import execa from 'execa';
|
|
17
|
-
import chalk from 'chalk';
|
|
18
|
-
|
|
19
|
-
function printWatchModeInstructions() {
|
|
20
|
-
logger.log(
|
|
21
|
-
`${chalk.bold('r')} - reload the app\n${chalk.bold(
|
|
22
|
-
'd',
|
|
23
|
-
)} - open developer menu\n${chalk.bold('i')} - run on iOS\n${chalk.bold(
|
|
24
|
-
'a',
|
|
25
|
-
)} - run on Android`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function enableWatchMode(
|
|
30
|
-
messageSocket: $ReadOnly<{
|
|
31
|
-
broadcast: (type: string, params?: Record<string, mixed> | null) => void,
|
|
32
|
-
...
|
|
33
|
-
}>,
|
|
34
|
-
ctx: Config,
|
|
35
|
-
) {
|
|
36
|
-
// We need to set this to true to catch key presses individually.
|
|
37
|
-
// As a result we have to implement our own method for exiting
|
|
38
|
-
// and other commands (e.g. ctrl+c & ctrl+z)
|
|
39
|
-
// $FlowIgnore[method-unbinding]
|
|
40
|
-
if (!process.stdin.setRawMode) {
|
|
41
|
-
logger.debug('Watch mode is not supported in this environment');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
readline.emitKeypressEvents(process.stdin);
|
|
46
|
-
|
|
47
|
-
// $FlowIgnore[prop-missing]
|
|
48
|
-
process.stdin.setRawMode(true);
|
|
49
|
-
|
|
50
|
-
// We have no way of knowing when the dependency graph is done loading
|
|
51
|
-
// except by hooking into stdout itself. We want to print instructions
|
|
52
|
-
// right after its done loading.
|
|
53
|
-
const restore: () => void = hookStdout((output: string) => {
|
|
54
|
-
// TODO(T160391951) Replace this string check with a suitable integration point
|
|
55
|
-
// in Metro
|
|
56
|
-
if (output.includes('Fast - Scalable - Integrated')) {
|
|
57
|
-
printWatchModeInstructions();
|
|
58
|
-
restore();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
process.stdin.on(
|
|
63
|
-
'keypress',
|
|
64
|
-
(_key: string, data: {ctrl: boolean, name: string}) => {
|
|
65
|
-
const {ctrl, name} = data;
|
|
66
|
-
if (ctrl === true) {
|
|
67
|
-
switch (name) {
|
|
68
|
-
case 'c':
|
|
69
|
-
process.exit();
|
|
70
|
-
break;
|
|
71
|
-
case 'z':
|
|
72
|
-
process.emit('SIGTSTP', 'SIGTSTP');
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
} else if (name === 'r') {
|
|
76
|
-
messageSocket.broadcast('reload', null);
|
|
77
|
-
logger.info('Reloading app...');
|
|
78
|
-
} else if (name === 'd') {
|
|
79
|
-
messageSocket.broadcast('devMenu', null);
|
|
80
|
-
logger.info('Opening developer menu...');
|
|
81
|
-
} else if (name === 'i' || name === 'a') {
|
|
82
|
-
logger.info(
|
|
83
|
-
`Opening the app on ${name === 'i' ? 'iOS' : 'Android'}...`,
|
|
84
|
-
);
|
|
85
|
-
const params =
|
|
86
|
-
name === 'i'
|
|
87
|
-
? ctx.project.ios?.watchModeCommandParams
|
|
88
|
-
: ctx.project.android?.watchModeCommandParams;
|
|
89
|
-
execa('npx', [
|
|
90
|
-
'react-native',
|
|
91
|
-
name === 'i' ? 'run-ios' : 'run-android',
|
|
92
|
-
...(params ?? []),
|
|
93
|
-
]).stdout?.pipe(process.stdout);
|
|
94
|
-
} else {
|
|
95
|
-
console.log(_key);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default enableWatchMode;
|
package/launchPackager.bat
DELETED
package/launchPackager.command
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
|
2
|
-
|
|
3
|
-
source "$THIS_DIR/.packager.env"
|
|
4
|
-
cd $PROJECT_ROOT
|
|
5
|
-
$REACT_NATIVE_PATH/cli.js start
|
|
6
|
-
|
|
7
|
-
if [[ -z "$CI" ]]; then
|
|
8
|
-
echo "Process terminated. Press <enter> to close the window"
|
|
9
|
-
read -r
|
|
10
|
-
fi
|