@nx/react-native 24.0.0-canary.20261019-c4bb923 → 24.0.0-canary.20261020-e7ffd79

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const diagnostics_channel_1 = require("diagnostics_channel");
4
+ const path_1 = require("path");
5
+ const tls_1 = require("tls");
6
+ const { TerminalReporter } = require(resolveMetro(process.cwd()));
7
+ /**
8
+ * Metro's terminal reporter, which also reports the dev server's address to an
9
+ * Nx task whose readyWhen is `signal`. `react-native start` loads it through
10
+ * `--custom-log-reporter-path`.
11
+ */
12
+ class NxMetroReporter extends TerminalReporter {
13
+ constructor(terminal) {
14
+ super(terminal);
15
+ this.secureByPort = new Map();
16
+ if (process.env.NX_READY_SIGNAL_SOCKET) {
17
+ // server_listening has no protocol, and Metro also serves HTTPS for a
18
+ // `server.tls` config. This channel publishes before that event fires.
19
+ (0, diagnostics_channel_1.subscribe)('tracing:net.server.listen:asyncEnd', (message) => {
20
+ const { server } = message;
21
+ const address = server.address();
22
+ if (address && typeof address === 'object') {
23
+ this.secureByPort.set(address.port, server instanceof tls_1.Server);
24
+ }
25
+ });
26
+ }
27
+ }
28
+ update(event) {
29
+ super.update(event);
30
+ if (event.type !== 'server_listening' ||
31
+ !process.env.NX_READY_SIGNAL_SOCKET) {
32
+ return;
33
+ }
34
+ const { emitReadySignal } = require('@nx/devkit');
35
+ const { getListeningUrl } = require('@nx/devkit/internal');
36
+ const listening = event;
37
+ emitReadySignal(getListeningUrl(listening, this.secureByPort.get(listening.port) ??
38
+ process.argv.includes('--https')));
39
+ }
40
+ }
41
+ // The metro react-native start uses. This package does not depend on metro,
42
+ // so a plain require can fail or find another hoisted version.
43
+ function resolveMetro(projectRoot) {
44
+ const reactNative = (0, path_1.dirname)(require.resolve('react-native/package.json', { paths: [projectRoot] }));
45
+ const cliPlugin = (0, path_1.dirname)(require.resolve('@react-native/community-cli-plugin/package.json', {
46
+ paths: [reactNative],
47
+ }));
48
+ return require.resolve('metro', { paths: [cliPlugin] });
49
+ }
50
+ module.exports = NxMetroReporter;
@@ -59,11 +59,7 @@ async function createNodesInternal(configFile, options, context, targetsCache, h
59
59
  function buildReactNativeTargets(projectRoot, options, context) {
60
60
  const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
61
61
  const targets = {
62
- [options.startTargetName]: {
63
- command: `react-native start`,
64
- continuous: true,
65
- options: { cwd: projectRoot },
66
- },
62
+ [options.startTargetName]: getStartTarget(projectRoot, context),
67
63
  [options.podInstallTargetName]: {
68
64
  command: `pod install`,
69
65
  options: { cwd: (0, devkit_1.joinPathFragments)(projectRoot, 'ios') },
@@ -112,6 +108,25 @@ function buildReactNativeTargets(projectRoot, options, context) {
112
108
  };
113
109
  return targets;
114
110
  }
111
+ const METRO_REPORTER_PATH = 'node_modules/@nx/react-native/dist/plugins/metro-reporter.js';
112
+ function getStartTarget(projectRoot, context) {
113
+ const target = {
114
+ command: `react-native start`,
115
+ continuous: true,
116
+ options: { cwd: projectRoot },
117
+ };
118
+ // react-native start fails on a missing reporter, as when the plugin is
119
+ // installed outside the root node_modules (e.g. .nx/installation)
120
+ if (!(0, fs_1.existsSync)((0, path_1.join)(context.workspaceRoot, METRO_REPORTER_PATH))) {
121
+ return target;
122
+ }
123
+ return {
124
+ ...target,
125
+ // Relative to the task's cwd, so the graph holds no machine-specific path
126
+ command: `react-native start --custom-log-reporter-path ${(0, devkit_1.offsetFromRoot)(projectRoot)}${METRO_REPORTER_PATH}`,
127
+ readyWhen: { signal: true },
128
+ };
129
+ }
115
130
  function getAppConfig(configFilePath, context) {
116
131
  const resolvedPath = (0, path_1.join)(context.workspaceRoot, configFilePath);
117
132
  return (0, internal_1.loadConfigFile)(resolvedPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "24.0.0-canary.20261019-c4bb923",
3
+ "version": "24.0.0-canary.20261020-e7ffd79",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
6
6
  "keywords": [
@@ -54,10 +54,10 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@nx/devkit": "24.0.0-canary.20261019-c4bb923",
58
- "@nx/js": "24.0.0-canary.20261019-c4bb923",
59
- "@nx/eslint": "24.0.0-canary.20261019-c4bb923",
60
- "@nx/react": "24.0.0-canary.20261019-c4bb923",
57
+ "@nx/devkit": "24.0.0-canary.20261020-e7ffd79",
58
+ "@nx/js": "24.0.0-canary.20261020-e7ffd79",
59
+ "@nx/eslint": "24.0.0-canary.20261020-e7ffd79",
60
+ "@nx/react": "24.0.0-canary.20261020-e7ffd79",
61
61
  "ajv": "^8.0.0",
62
62
  "enhanced-resolve": "^5.8.3",
63
63
  "ignore": "^7.0.5",
@@ -78,12 +78,12 @@
78
78
  }
79
79
  },
80
80
  "devDependencies": {
81
- "@nx/webpack": "24.0.0-canary.20261019-c4bb923",
82
- "nx": "24.0.0-canary.20261019-c4bb923"
81
+ "@nx/webpack": "24.0.0-canary.20261020-e7ffd79",
82
+ "nx": "24.0.0-canary.20261020-e7ffd79"
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/detox": "24.0.0-canary.20261019-c4bb923",
86
- "@nx/rollup": "24.0.0-canary.20261019-c4bb923"
85
+ "@nx/detox": "24.0.0-canary.20261020-e7ffd79",
86
+ "@nx/rollup": "24.0.0-canary.20261020-e7ffd79"
87
87
  },
88
88
  "executors": "./executors.json",
89
89
  "ng-update": {