Skip to content

Commit 0217cba

Browse files
feat(config): add server.forwardClientLogs option
1 parent 159484a commit 0217cba

12 files changed

Lines changed: 531 additions & 10 deletions

File tree

actions/shared/index.cjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3995,7 +3995,7 @@ ZodNaN.create = (params) => {
39953995
...processCreateParams(params)
39963996
});
39973997
};
3998-
var BRAND = Symbol("zod_brand");
3998+
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
39993999
var ZodBranded = class extends ZodType {
40004000
_parse(input) {
40014001
const { ctx } = this._processInputParams(input);
@@ -4231,6 +4231,9 @@ var ConfigSchema = external_exports.object({
42314231
coverage: external_exports.object({
42324232
root: external_exports.string().optional().describe(`Root directory for coverage instrumentation in monorepo setups. Specifies the directory from which coverage data should be collected. Use ".." for create-react-native-library projects where tests run from example/ but source files are in parent directory. Passed to babel-plugin-istanbul's cwd option.`)
42334233
}).optional(),
4234+
server: external_exports.object({
4235+
forwardClientLogs: external_exports.boolean().optional().default(false).describe("Enable forwarding of client_log events from the device to the Metro reporter. When enabled, console.log statements from the React Native app will be forwarded to Metro.")
4236+
}).optional(),
42344237
// Deprecated property - used for migration detection
42354238
include: external_exports.array(external_exports.string()).optional()
42364239
}).refine((config) => {
@@ -4262,7 +4265,6 @@ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
42624265
var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
42634266
var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
42644267
var bt = globalThis.process.platform.startsWith("win");
4265-
var z = Symbol("clack:cancel");
42664268

42674269
// ../../node_modules/@clack/prompts/dist/index.mjs
42684270
var import_picocolors = __toESM(require_picocolors(), 1);
@@ -4289,7 +4291,7 @@ var Y = w("\u25CF", ">");
42894291
var K = w("\u25CB", " ");
42904292
var te = w("\u25FB", "[\u2022]");
42914293
var k2 = w("\u25FC", "[+]");
4292-
var z2 = w("\u25FB", "[ ]");
4294+
var z = w("\u25FB", "[ ]");
42934295
var Pe = w("\u25AA", "\u2022");
42944296
var se = w("\u2500", "-");
42954297
var he = w("\u256E", "+");

apps/playground/rn-harness.config.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export default {
2424

2525
runners: [
2626
androidPlatform({
27-
name: 'pixel_8_api_33',
28-
device: androidEmulator('Pixel_8_API_33'),
29-
bundleId: 'com.example',
27+
name: 'pixel_8_api_35',
28+
device: androidEmulator('Pixel_8_API_35'),
29+
bundleId: 'com.harnessplayground',
3030
}),
3131
applePlatform({
3232
name: 'iphone-16-pro-max',
@@ -42,5 +42,8 @@ export default {
4242
browser: chromium('http://localhost:8081/index.html', { headless: true }),
4343
}),
4444
],
45-
defaultRunner: 'pixel_8_api_33',
45+
defaultRunner: 'pixel_8_api_35',
46+
server: {
47+
forwardClientLogs: true,
48+
},
4649
};
865 Bytes
Loading

packages/bundler-metro/src/reporter.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ export type ReportableEvent =
77
| MetroReportableEvent
88
| {
99
type: 'initialize_done';
10+
}
11+
| {
12+
type: 'client_log';
13+
level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug' | 'error';
14+
data: unknown[];
1015
};
1116

1217
export type Reporter = EventEmitter<ReportableEvent>;

packages/config/src/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ export const ConfigSchema = z
6060
})
6161
.optional(),
6262

63+
server: z
64+
.object({
65+
forwardClientLogs: z
66+
.boolean()
67+
.optional()
68+
.default(false)
69+
.describe(
70+
'Enable forwarding of client_log events from the device to the Metro reporter. ' +
71+
'When enabled, console.log statements from the React Native app will be forwarded to Metro.'
72+
),
73+
})
74+
.optional(),
75+
6376
// Deprecated property - used for migration detection
6477
include: z.array(z.string()).optional(),
6578
})

packages/jest/eslint.config.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export default [
88
'@nx/dependency-checks': [
99
'error',
1010
{
11-
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
11+
ignoredFiles: [
12+
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
13+
'{projectRoot}/vite.config.{js,cjs,mjs,ts,cts,mts}',
14+
],
1215
// jest-runner: we only ingest types
1316
ignoredDependencies: ['@react-native-harness/cli', 'jest-runner'],
1417
},

0 commit comments

Comments
 (0)