@react-native/community-cli-plugin 0.75.0-rc.1 → 0.76.0-nightly-20240627-TEMP
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/dist/commands/bundle/assetCatalogIOS.js +0 -11
- package/dist/commands/bundle/assetPathUtils.js +3 -21
- package/dist/commands/bundle/buildBundle.js +0 -36
- package/dist/commands/bundle/filterPlatformAssetScales.js +0 -16
- package/dist/commands/bundle/getAssetDestPathAndroid.js +0 -11
- package/dist/commands/bundle/getAssetDestPathIOS.js +0 -14
- package/dist/commands/bundle/index.js +0 -11
- package/dist/commands/bundle/saveAssets.js +0 -14
- package/dist/commands/start/attachKeyHandlers.js +0 -11
- package/dist/commands/start/index.js +0 -11
- package/dist/commands/start/runServer.js +0 -31
- package/dist/utils/KeyPressHandler.js +0 -26
- package/dist/utils/isDevServerRunning.js +0 -21
- package/dist/utils/loadMetroConfig.js +0 -23
- package/dist/utils/metroPlatformResolver.js +0 -25
- package/dist/utils/parseKeyValueParamArray.js +0 -11
- package/package.json +5 -5
|
@@ -13,17 +13,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
13
13
|
function _interopRequireDefault(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the MIT license found in the
|
|
20
|
-
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @format
|
|
24
|
-
* @oncall react_native
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
16
|
function cleanAssetCatalog(catalogDir) {
|
|
28
17
|
const files = _fs.default
|
|
29
18
|
.readdirSync(catalogDir)
|
|
@@ -4,21 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @format
|
|
15
|
-
* @oncall react_native
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* FIXME: using number to represent discrete scale numbers is fragile in essence because of
|
|
20
|
-
* floating point numbers imprecision.
|
|
21
|
-
*/
|
|
22
7
|
function getAndroidAssetSuffix(scale) {
|
|
23
8
|
switch (scale) {
|
|
24
9
|
case 0.75:
|
|
@@ -37,8 +22,6 @@ function getAndroidAssetSuffix(scale) {
|
|
|
37
22
|
return "";
|
|
38
23
|
}
|
|
39
24
|
}
|
|
40
|
-
|
|
41
|
-
// See https://developer.android.com/guide/topics/resources/drawable-resource.html
|
|
42
25
|
const drawableFileTypes = new Set(["gif", "jpeg", "jpg", "png", "webp", "xml"]);
|
|
43
26
|
function getAndroidResourceFolderName(asset, scale) {
|
|
44
27
|
if (!drawableFileTypes.has(asset.type)) {
|
|
@@ -58,11 +41,10 @@ function getResourceIdentifier(asset) {
|
|
|
58
41
|
const folderPath = getBasePath(asset);
|
|
59
42
|
return `${folderPath}/${asset.name}`
|
|
60
43
|
.toLowerCase()
|
|
61
|
-
.replace(/\//g, "_")
|
|
62
|
-
.replace(/([^a-z0-9_])/g, "")
|
|
63
|
-
.replace(/^assets_/, "");
|
|
44
|
+
.replace(/\//g, "_")
|
|
45
|
+
.replace(/([^a-z0-9_])/g, "")
|
|
46
|
+
.replace(/^assets_/, "");
|
|
64
47
|
}
|
|
65
|
-
|
|
66
48
|
function getBasePath(asset) {
|
|
67
49
|
let basePath = asset.httpServerLocation;
|
|
68
50
|
if (basePath[0] === "/") {
|
|
@@ -22,17 +22,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
22
22
|
function _interopRequireDefault(obj) {
|
|
23
23
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the MIT license found in the
|
|
29
|
-
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @format
|
|
33
|
-
* @oncall react_native
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
25
|
async function buildBundle(_argv, ctx, args, bundleImpl = _bundle.default) {
|
|
37
26
|
const config = await (0, _loadMetroConfig.default)(ctx, {
|
|
38
27
|
maxWorkers: args.maxWorkers,
|
|
@@ -64,16 +53,11 @@ async function buildBundleWithConfig(
|
|
|
64
53
|
);
|
|
65
54
|
throw new Error("Bundling failed");
|
|
66
55
|
}
|
|
67
|
-
|
|
68
|
-
// This is used by a bazillion of npm modules we don't control so we don't
|
|
69
|
-
// have other choice than defining it as an env variable here.
|
|
70
56
|
process.env.NODE_ENV = args.dev ? "development" : "production";
|
|
71
57
|
let sourceMapUrl = args.sourcemapOutput;
|
|
72
58
|
if (sourceMapUrl != null && !args.sourcemapUseAbsolutePath) {
|
|
73
59
|
sourceMapUrl = _path.default.basename(sourceMapUrl);
|
|
74
60
|
}
|
|
75
|
-
|
|
76
|
-
// $FlowIgnore[prop-missing]
|
|
77
61
|
const requestOpts = {
|
|
78
62
|
entryFile: args.entryFile,
|
|
79
63
|
sourceMapUrl,
|
|
@@ -86,21 +70,12 @@ async function buildBundleWithConfig(
|
|
|
86
70
|
const server = new _Server.default(config);
|
|
87
71
|
try {
|
|
88
72
|
const bundle = await bundleImpl.build(server, requestOpts);
|
|
89
|
-
|
|
90
|
-
// $FlowIgnore[class-object-subtyping]
|
|
91
|
-
// $FlowIgnore[incompatible-call]
|
|
92
|
-
// $FlowIgnore[prop-missing]
|
|
93
|
-
// $FlowIgnore[incompatible-exact]
|
|
94
73
|
await bundleImpl.save(bundle, args, _cliTools.logger.info);
|
|
95
|
-
|
|
96
|
-
// Save the assets of the bundle
|
|
97
74
|
const outputAssets = await server.getAssets({
|
|
98
75
|
..._Server.default.DEFAULT_BUNDLE_OPTIONS,
|
|
99
76
|
...requestOpts,
|
|
100
77
|
bundleType: "todo",
|
|
101
78
|
});
|
|
102
|
-
|
|
103
|
-
// When we're done saving bundle output and the assets, we're done.
|
|
104
79
|
return await (0, _saveAssets.default)(
|
|
105
80
|
outputAssets,
|
|
106
81
|
args.platform,
|
|
@@ -111,17 +86,6 @@ async function buildBundleWithConfig(
|
|
|
111
86
|
server.end();
|
|
112
87
|
}
|
|
113
88
|
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* UNSTABLE: This function is likely to be relocated and its API changed in
|
|
117
|
-
* the near future. `@react-native/community-cli-plugin` should not be directly
|
|
118
|
-
* depended on by projects or integrators -- this is exported for legacy
|
|
119
|
-
* compatibility.
|
|
120
|
-
*
|
|
121
|
-
* Create a bundle using a pre-loaded Metro config. The config can be
|
|
122
|
-
* re-used for several bundling calls if multiple platforms are being
|
|
123
|
-
* bundled.
|
|
124
|
-
*/
|
|
125
89
|
const unstable_buildBundleWithConfig = buildBundleWithConfig;
|
|
126
90
|
exports.unstable_buildBundleWithConfig = unstable_buildBundleWithConfig;
|
|
127
91
|
var _default = buildBundle;
|
|
@@ -4,17 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @format
|
|
15
|
-
* @oncall react_native
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
7
|
const ALLOWED_SCALES = {
|
|
19
8
|
ios: [1, 2, 3],
|
|
20
9
|
};
|
|
@@ -25,9 +14,6 @@ function filterPlatformAssetScales(platform, scales) {
|
|
|
25
14
|
}
|
|
26
15
|
const result = scales.filter((scale) => whitelist.indexOf(scale) > -1);
|
|
27
16
|
if (result.length === 0 && scales.length > 0) {
|
|
28
|
-
// No matching scale found, but there are some available. Ideally we don't
|
|
29
|
-
// want to be in this situation and should throw, but for now as a fallback
|
|
30
|
-
// let's just use the closest larger image
|
|
31
17
|
const maxScale = whitelist[whitelist.length - 1];
|
|
32
18
|
for (const scale of scales) {
|
|
33
19
|
if (scale > maxScale) {
|
|
@@ -35,8 +21,6 @@ function filterPlatformAssetScales(platform, scales) {
|
|
|
35
21
|
break;
|
|
36
22
|
}
|
|
37
23
|
}
|
|
38
|
-
|
|
39
|
-
// There is no larger scales available, use the largest we have
|
|
40
24
|
if (result.length === 0) {
|
|
41
25
|
result.push(scales[scales.length - 1]);
|
|
42
26
|
}
|
|
@@ -9,17 +9,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
function _interopRequireDefault(obj) {
|
|
10
10
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @format
|
|
20
|
-
* @oncall react_native
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
12
|
function getAssetDestPathAndroid(asset, scale) {
|
|
24
13
|
const androidFolder = _assetPathUtils.default.getAndroidResourceFolderName(
|
|
25
14
|
asset,
|
|
@@ -8,24 +8,10 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
8
8
|
function _interopRequireDefault(obj) {
|
|
9
9
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the MIT license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @format
|
|
19
|
-
* @oncall react_native
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
11
|
function getAssetDestPathIOS(asset, scale) {
|
|
23
12
|
const suffix = scale === 1 ? "" : `@${scale}x`;
|
|
24
13
|
const fileName = `${asset.name + suffix}.${asset.type}`;
|
|
25
14
|
return _path.default.join(
|
|
26
|
-
// Assets can have relative paths outside of the project root.
|
|
27
|
-
// Replace `../` with `_` to make sure they don't end up outside of
|
|
28
|
-
// the expected assets directory.
|
|
29
15
|
asset.httpServerLocation.substr(1).replace(/\.\.\//g, "_"),
|
|
30
16
|
fileName
|
|
31
17
|
);
|
|
@@ -9,17 +9,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
function _interopRequireDefault(obj) {
|
|
10
10
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @format
|
|
20
|
-
* @oncall react_native
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
12
|
const bundleCommand = {
|
|
24
13
|
name: "bundle",
|
|
25
14
|
description: "Build the bundle for the provided JavaScript entry file.",
|
|
@@ -20,17 +20,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
20
20
|
function _interopRequireDefault(obj) {
|
|
21
21
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the MIT license found in the
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @format
|
|
31
|
-
* @oncall react_native
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
23
|
async function saveAssets(assets, platform, assetsDest, assetCatalogDest) {
|
|
35
24
|
if (assetsDest == null) {
|
|
36
25
|
_cliTools.logger.warn("Assets destination folder is not set, skipping...");
|
|
@@ -58,8 +47,6 @@ async function saveAssets(assets, platform, assetsDest, assetCatalogDest) {
|
|
|
58
47
|
});
|
|
59
48
|
};
|
|
60
49
|
if (platform === "ios" && assetCatalogDest != null) {
|
|
61
|
-
// Use iOS Asset Catalog for images. This will allow Apple app thinning to
|
|
62
|
-
// remove unused scales from the optimized bundle.
|
|
63
50
|
const catalogDir = _path.default.join(
|
|
64
51
|
assetCatalogDest,
|
|
65
52
|
"RNAssets.xcassets"
|
|
@@ -106,7 +93,6 @@ function copyAll(filesToCopy) {
|
|
|
106
93
|
_cliTools.logger.info("Done copying assets");
|
|
107
94
|
resolve();
|
|
108
95
|
} else {
|
|
109
|
-
// queue.length === 0 is checked in previous branch, so this is string
|
|
110
96
|
const src = queue.shift();
|
|
111
97
|
const dest = filesToCopy[src];
|
|
112
98
|
copy(src, dest, copyNext);
|
|
@@ -12,17 +12,6 @@ var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
|
12
12
|
function _interopRequireDefault(obj) {
|
|
13
13
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the MIT license found in the
|
|
19
|
-
* LICENSE file in the root directory of this source tree.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @format
|
|
23
|
-
* @oncall react_native
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
15
|
const CTRL_C = "\u0003";
|
|
27
16
|
const CTRL_D = "\u0004";
|
|
28
17
|
function attachKeyHandlers({
|
|
@@ -9,17 +9,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
function _interopRequireDefault(obj) {
|
|
10
10
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @format
|
|
20
|
-
* @oncall react_native
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
12
|
const startCommand = {
|
|
24
13
|
name: "start",
|
|
25
14
|
func: _runServer.default,
|
|
@@ -22,17 +22,6 @@ var _url = _interopRequireDefault(require("url"));
|
|
|
22
22
|
function _interopRequireDefault(obj) {
|
|
23
23
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the MIT license found in the
|
|
29
|
-
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @format
|
|
33
|
-
* @oncall react_native
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
25
|
async function runServer(_argv, ctx, args) {
|
|
37
26
|
const metroConfig = await (0, _loadMetroConfig.default)(ctx, {
|
|
38
27
|
config: args.config,
|
|
@@ -76,7 +65,6 @@ async function runServer(_argv, ctx, args) {
|
|
|
76
65
|
`Starting dev server on port ${_chalk.default.bold(String(port))}...`
|
|
77
66
|
);
|
|
78
67
|
if (args.assetPlugins) {
|
|
79
|
-
// $FlowIgnore[cannot-write] Assigning to readonly property
|
|
80
68
|
metroConfig.transformer.assetPlugins = args.assetPlugins.map((plugin) =>
|
|
81
69
|
require.resolve(plugin)
|
|
82
70
|
);
|
|
@@ -97,7 +85,6 @@ async function runServer(_argv, ctx, args) {
|
|
|
97
85
|
serverBaseUrl: devServerUrl,
|
|
98
86
|
logger: _cliTools.logger,
|
|
99
87
|
unstable_experiments: {
|
|
100
|
-
// NOTE: Only affects the /open-debugger endpoint
|
|
101
88
|
enableNewDebugger: args.experimentalDebugger,
|
|
102
89
|
},
|
|
103
90
|
});
|
|
@@ -105,7 +92,6 @@ async function runServer(_argv, ctx, args) {
|
|
|
105
92
|
const terminal = new _metroCore.Terminal(process.stdout);
|
|
106
93
|
const ReporterImpl = getReporterImpl(args.customLogReporterPath);
|
|
107
94
|
const terminalReporter = new ReporterImpl(terminal);
|
|
108
|
-
// $FlowIgnore[cannot-write] Assigning to readonly property
|
|
109
95
|
metroConfig.reporter = {
|
|
110
96
|
update(event) {
|
|
111
97
|
terminalReporter.update(event);
|
|
@@ -139,17 +125,6 @@ async function runServer(_argv, ctx, args) {
|
|
|
139
125
|
},
|
|
140
126
|
});
|
|
141
127
|
reportEvent = eventsSocketEndpoint.reportEvent;
|
|
142
|
-
|
|
143
|
-
// In Node 8, the default keep-alive for an HTTP connection is 5 seconds. In
|
|
144
|
-
// early versions of Node 8, this was implemented in a buggy way which caused
|
|
145
|
-
// some HTTP responses (like those containing large JS bundles) to be
|
|
146
|
-
// terminated early.
|
|
147
|
-
//
|
|
148
|
-
// As a workaround, arbitrarily increase the keep-alive from 5 to 30 seconds,
|
|
149
|
-
// which should be enough to send even the largest of JS bundles.
|
|
150
|
-
//
|
|
151
|
-
// For more info: https://github.com/nodejs/node/issues/13391
|
|
152
|
-
//
|
|
153
128
|
serverInstance.keepAliveTimeout = 30000;
|
|
154
129
|
await _cliTools.version.logIfUpdateAvailable(ctx.root);
|
|
155
130
|
}
|
|
@@ -158,17 +133,11 @@ function getReporterImpl(customLogReporterPath) {
|
|
|
158
133
|
return require("metro/src/lib/TerminalReporter");
|
|
159
134
|
}
|
|
160
135
|
try {
|
|
161
|
-
// First we let require resolve it, so we can require packages in node_modules
|
|
162
|
-
// as expected. eg: require('my-package/reporter');
|
|
163
|
-
// $FlowIgnore[unsupported-syntax]
|
|
164
136
|
return require(customLogReporterPath);
|
|
165
137
|
} catch (e) {
|
|
166
138
|
if (e.code !== "MODULE_NOT_FOUND") {
|
|
167
139
|
throw e;
|
|
168
140
|
}
|
|
169
|
-
// If that doesn't work, then we next try relative to the cwd, eg:
|
|
170
|
-
// require('./reporter');
|
|
171
|
-
// $FlowIgnore[unsupported-syntax]
|
|
172
141
|
return require(_path.default.resolve(customLogReporterPath));
|
|
173
142
|
}
|
|
174
143
|
}
|
|
@@ -5,46 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.KeyPressHandler = void 0;
|
|
7
7
|
var _cliTools = require("@react-native-community/cli-tools");
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @format
|
|
16
|
-
* @oncall react_native
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
8
|
const CTRL_C = "\u0003";
|
|
20
|
-
|
|
21
|
-
/** An abstract key stroke interceptor. */
|
|
22
9
|
class KeyPressHandler {
|
|
23
10
|
_isInterceptingKeyStrokes = false;
|
|
24
11
|
_isHandlingKeyPress = false;
|
|
25
12
|
constructor(onPress) {
|
|
26
13
|
this._onPress = onPress;
|
|
27
14
|
}
|
|
28
|
-
|
|
29
|
-
/** Start observing interaction pause listeners. */
|
|
30
15
|
createInteractionListener() {
|
|
31
|
-
// Support observing prompts.
|
|
32
16
|
let wasIntercepting = false;
|
|
33
17
|
const listener = ({ pause }) => {
|
|
34
18
|
if (pause) {
|
|
35
|
-
// Track if we were already intercepting key strokes before pausing, so we can
|
|
36
|
-
// resume after pausing.
|
|
37
19
|
wasIntercepting = this._isInterceptingKeyStrokes;
|
|
38
20
|
this.stopInterceptingKeyStrokes();
|
|
39
21
|
} else if (wasIntercepting) {
|
|
40
|
-
// Only start if we were previously intercepting.
|
|
41
22
|
this.startInterceptingKeyStrokes();
|
|
42
23
|
}
|
|
43
24
|
};
|
|
44
25
|
return listener;
|
|
45
26
|
}
|
|
46
27
|
_handleKeypress = async (key) => {
|
|
47
|
-
// Prevent sending another event until the previous event has finished.
|
|
48
28
|
if (this._isHandlingKeyPress && key !== CTRL_C) {
|
|
49
29
|
return;
|
|
50
30
|
}
|
|
@@ -60,22 +40,17 @@ class KeyPressHandler {
|
|
|
60
40
|
this._isHandlingKeyPress = false;
|
|
61
41
|
}
|
|
62
42
|
};
|
|
63
|
-
|
|
64
|
-
/** Start intercepting all key strokes and passing them to the input `onPress` method. */
|
|
65
43
|
startInterceptingKeyStrokes() {
|
|
66
44
|
if (this._isInterceptingKeyStrokes) {
|
|
67
45
|
return;
|
|
68
46
|
}
|
|
69
47
|
this._isInterceptingKeyStrokes = true;
|
|
70
48
|
const { stdin } = process;
|
|
71
|
-
// $FlowFixMe[prop-missing]
|
|
72
49
|
stdin.setRawMode(true);
|
|
73
50
|
stdin.resume();
|
|
74
51
|
stdin.setEncoding("utf8");
|
|
75
52
|
stdin.on("data", this._handleKeypress);
|
|
76
53
|
}
|
|
77
|
-
|
|
78
|
-
/** Stop intercepting all key strokes. */
|
|
79
54
|
stopInterceptingKeyStrokes() {
|
|
80
55
|
if (!this._isInterceptingKeyStrokes) {
|
|
81
56
|
return;
|
|
@@ -83,7 +58,6 @@ class KeyPressHandler {
|
|
|
83
58
|
this._isInterceptingKeyStrokes = false;
|
|
84
59
|
const { stdin } = process;
|
|
85
60
|
stdin.removeListener("data", this._handleKeypress);
|
|
86
|
-
// $FlowFixMe[prop-missing]
|
|
87
61
|
stdin.setRawMode(false);
|
|
88
62
|
stdin.resume();
|
|
89
63
|
}
|
|
@@ -9,27 +9,6 @@ var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
|
9
9
|
function _interopRequireDefault(obj) {
|
|
10
10
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @format
|
|
20
|
-
* @oncall react_native
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Determine whether we can run the dev server.
|
|
25
|
-
*
|
|
26
|
-
* Return values:
|
|
27
|
-
* - `not_running`: The port is unoccupied.
|
|
28
|
-
* - `matched_server_running`: The port is occupied by another instance of this
|
|
29
|
-
* dev server (matching the passed `projectRoot`).
|
|
30
|
-
* - `port_taken`: The port is occupied by another process.
|
|
31
|
-
* - `unknown`: An error was encountered; attempt server creation anyway.
|
|
32
|
-
*/
|
|
33
12
|
async function isDevServerRunning(devServerUrl, projectRoot) {
|
|
34
13
|
const { hostname, port } = new URL(devServerUrl);
|
|
35
14
|
try {
|
|
@@ -11,20 +11,6 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
11
11
|
function _interopRequireDefault(obj) {
|
|
12
12
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
13
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
|
-
/**
|
|
26
|
-
* Get the config options to override based on RN CLI inputs.
|
|
27
|
-
*/
|
|
28
14
|
function getOverrideConfig(ctx, config) {
|
|
29
15
|
const outOfTreePlatforms = Object.keys(ctx.platforms).filter(
|
|
30
16
|
(platform) => ctx.platforms[platform].npmPackageName
|
|
@@ -45,8 +31,6 @@ function getOverrideConfig(ctx, config) {
|
|
|
45
31
|
return {
|
|
46
32
|
resolver,
|
|
47
33
|
serializer: {
|
|
48
|
-
// We can include multiple copies of InitializeCore here because metro will
|
|
49
|
-
// only add ones that are already part of the bundle
|
|
50
34
|
getModulesRunBeforeMainModule: () => [
|
|
51
35
|
require.resolve(
|
|
52
36
|
_path.default.join(
|
|
@@ -69,13 +53,6 @@ function getOverrideConfig(ctx, config) {
|
|
|
69
53
|
},
|
|
70
54
|
};
|
|
71
55
|
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Load Metro config.
|
|
75
|
-
*
|
|
76
|
-
* Allows the CLI to override select values in `metro.config.js` based on
|
|
77
|
-
* dynamic user options in `ctx`.
|
|
78
|
-
*/
|
|
79
56
|
async function loadMetroConfig(ctx, options = {}) {
|
|
80
57
|
const cwd = ctx.root;
|
|
81
58
|
const projectConfig = await (0, _metroConfig.resolveConfig)(
|
|
@@ -4,31 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports.reactNativePlatformResolver = reactNativePlatformResolver;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the MIT license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @format
|
|
15
|
-
* @oncall react_native
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* This is an implementation of a metro resolveRequest option which will remap react-native imports
|
|
20
|
-
* to different npm packages based on the platform requested. This allows a single metro instance/config
|
|
21
|
-
* to produce bundles for multiple out of tree platforms at a time.
|
|
22
|
-
*
|
|
23
|
-
* @param platformImplementations
|
|
24
|
-
* A map of platform to npm package that implements that platform
|
|
25
|
-
*
|
|
26
|
-
* Ex:
|
|
27
|
-
* {
|
|
28
|
-
* windows: 'react-native-windows'
|
|
29
|
-
* macos: 'react-native-macos'
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
7
|
function reactNativePlatformResolver(platformImplementations, customResolver) {
|
|
33
8
|
return (context, moduleName, platform) => {
|
|
34
9
|
let modifiedModuleName = moduleName;
|
|
@@ -8,17 +8,6 @@ var _querystring = _interopRequireDefault(require("querystring"));
|
|
|
8
8
|
function _interopRequireDefault(obj) {
|
|
9
9
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the MIT license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @format
|
|
19
|
-
* @oncall react_native
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
11
|
function parseKeyValueParamArray(keyValueArray) {
|
|
23
12
|
const result = {};
|
|
24
13
|
for (const item of keyValueArray) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/community-cli-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0-nightly-20240627-TEMP",
|
|
4
4
|
"description": "Core CLI commands for React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-native-community/cli-server-api": "14.0.0-alpha.
|
|
26
|
-
"@react-native-community/cli-tools": "14.0.0-alpha.
|
|
27
|
-
"@react-native/dev-middleware": "0.
|
|
28
|
-
"@react-native/metro-babel-transformer": "0.
|
|
25
|
+
"@react-native-community/cli-server-api": "14.0.0-alpha.9",
|
|
26
|
+
"@react-native-community/cli-tools": "14.0.0-alpha.9",
|
|
27
|
+
"@react-native/dev-middleware": "0.76.0-nightly-20240627-TEMP",
|
|
28
|
+
"@react-native/metro-babel-transformer": "0.76.0-nightly-20240627-TEMP",
|
|
29
29
|
"chalk": "^4.0.0",
|
|
30
30
|
"execa": "^5.1.1",
|
|
31
31
|
"metro": "^0.80.3",
|