react-x11 2.22.12 → 2.22.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-x11",
3
- "version": "2.22.12",
3
+ "version": "2.22.13",
4
4
  "description": "react renderer with X11 as a target",
5
5
  "main": "./src/index.js",
6
6
  "files": [
package/src/cocoa/main.js CHANGED
@@ -17,6 +17,11 @@
17
17
  // import's). Anywhere else it does nothing, so one command line serves
18
18
  // every platform: on Linux the entry runs as it would without it, and so
19
19
  // does a Worker the app starts itself (it inherits this `--import`).
20
+ //
21
+ // Of the checks it skips, it keeps one: a `<Frame>` pane stays where it is.
22
+ // The host forks the pane with the node flags it started with, this
23
+ // `--import` among them, and a pane on a worker has no IPC channel to its
24
+ // host (src/cocoa/relaunch.js, `relaunchVeto`).
20
25
  import { isMainThread, workerData } from 'node:worker_threads';
21
26
 
22
27
  import { loadNative } from './native.js';
@@ -24,7 +29,11 @@ import { bootstrapWorker, relaunch } from './relaunch.js';
24
29
 
25
30
  if (!isMainThread && workerData?.reactX11State) {
26
31
  bootstrapWorker(workerData.reactX11State);
27
- } else if (isMainThread && process.platform === 'darwin') {
32
+ } else if (
33
+ isMainThread &&
34
+ process.platform === 'darwin' &&
35
+ process.env.REACT_X11_FRAME !== '1'
36
+ ) {
28
37
  const entry = process.argv[1];
29
38
  if (!entry) {
30
39
  throw new Error(
@@ -67,6 +67,13 @@ export function relaunchVeto({
67
67
  if (env.REACT_X11_BACKEND && env.REACT_X11_BACKEND !== 'cocoa') {
68
68
  return `REACT_X11_BACKEND=${env.REACT_X11_BACKEND}`;
69
69
  }
70
+ // A `<Frame>` pane (REACT_X11_FRAME is what the host sets on the fork)
71
+ // has no AppKit for the main thread to keep — its pixels reach the host
72
+ // through shared IOSurfaces (src/cocoa/panewindow.js) — and its entry
73
+ // talks to the host over the IPC channel fork() sets up, which is the
74
+ // main thread's: on a worker there is no `process.send`, and the pane
75
+ // exited as it started (src/frame/child.js).
76
+ if (env.REACT_X11_FRAME === '1') return 'a <Frame> pane';
70
77
  // a REPL, `node -e`, or an entry that is not a file a worker can load
71
78
  if (!entry) return 'no entry script';
72
79
  // a single executable carries its entry inside the binary, where a worker
@@ -4,12 +4,20 @@
4
4
  // `process`. Kept import-light and JSX-free on purpose: it runs before
5
5
  // anything decided what loaders this process has.
6
6
 
7
+ import { isMainThread } from 'node:worker_threads';
8
+
7
9
  import { runFrameChild } from './childmain.js';
8
10
 
9
11
  if (typeof process.send !== 'function') {
10
12
  console.error(
11
- 'react-x11: frame/child.js is the entry a <Frame> forks — it needs the ' +
12
- 'IPC channel fork() sets up, and cannot be run directly.',
13
+ isMainThread
14
+ ? 'react-x11: frame/child.js is the entry a <Frame> forks — it needs ' +
15
+ 'the IPC channel fork() sets up, and cannot be run directly.'
16
+ : // the channel is the main thread's, and something moved the pane
17
+ // off it (src/cocoa/relaunch.js keeps a pane where it is)
18
+ 'react-x11: frame/child.js is running on a worker thread, which ' +
19
+ 'has no IPC channel — a <Frame> pane has to stay on the main ' +
20
+ 'thread of its process.',
13
21
  );
14
22
  process.exit(1);
15
23
  }