@solidnative-dev/fabric-host 0.0.0-stage → 0.1.0-beta.0

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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -2
  3. package/dist/fatal-error-handler.d.ts +27 -0
  4. package/dist/fatal-error-handler.d.ts.map +1 -0
  5. package/dist/fatal-error-handler.js +106 -0
  6. package/dist/fatal-error-handler.js.map +1 -0
  7. package/dist/index.d.ts +7 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +7 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/native-binding.d.ts +183 -0
  12. package/dist/native-binding.d.ts.map +1 -0
  13. package/dist/native-binding.js +554 -0
  14. package/dist/native-binding.js.map +1 -0
  15. package/dist/native-fabric-host.d.ts +32 -0
  16. package/dist/native-fabric-host.d.ts.map +1 -0
  17. package/dist/native-fabric-host.js +275 -0
  18. package/dist/native-fabric-host.js.map +1 -0
  19. package/dist/native-transaction.d.ts +17 -0
  20. package/dist/native-transaction.d.ts.map +1 -0
  21. package/dist/native-transaction.js +124 -0
  22. package/dist/native-transaction.js.map +1 -0
  23. package/dist/react-native-0.88.d.ts +77 -0
  24. package/dist/react-native-0.88.d.ts.map +1 -0
  25. package/dist/react-native-0.88.js +79 -0
  26. package/dist/react-native-0.88.js.map +1 -0
  27. package/dist/surface-readiness.d.ts +18 -0
  28. package/dist/surface-readiness.d.ts.map +1 -0
  29. package/dist/surface-readiness.js +43 -0
  30. package/dist/surface-readiness.js.map +1 -0
  31. package/native/README.md +502 -0
  32. package/native/SolidNativeFabric.podspec +84 -0
  33. package/native/android/SolidNativeBindingsInstaller.cpp +4218 -0
  34. package/native/android/SolidNativeBindingsInstaller.h +8 -0
  35. package/native/android/SolidNativeRuntime.cmake +61 -0
  36. package/native/android/java/dev/solidnative/runtime/SolidNativeBindingsInstaller.kt +239 -0
  37. package/native/android/java/dev/solidnative/runtime/SolidNativeDebugModule.kt +191 -0
  38. package/native/android/java/dev/solidnative/runtime/SolidNativePackage.kt +43 -0
  39. package/native/android/java/dev/solidnative/runtime/SolidNativePlatformModule.kt +81 -0
  40. package/native/android/java/dev/solidnative/runtime/SolidNativeStartupFailureView.kt +93 -0
  41. package/native/android/java/dev/solidnative/runtime/SolidNativeSurface.kt +423 -0
  42. package/native/android/solid-native.gradle +90 -0
  43. package/native/apple/SolidNativeDebugRequest.mm +421 -0
  44. package/native/fabric/SolidNativeDebugRequest.h +12 -0
  45. package/native/fabric/SolidNativeDirtyNodes.h +26 -0
  46. package/native/fabric/SolidNativeFabricApi.cpp +224 -0
  47. package/native/fabric/SolidNativeFabricApi.h +107 -0
  48. package/native/fabric/SolidNativeFabricApplication.h +32 -0
  49. package/native/fabric/SolidNativeFabricApplication.mm +373 -0
  50. package/native/fabric/SolidNativeFabricJSIBinding.h +43 -0
  51. package/native/fabric/SolidNativeFabricJSIBinding.mm +4491 -0
  52. package/native/fabric/SolidNativeFabricSmokeApplication.h +26 -0
  53. package/native/fabric/SolidNativeFabricSmokeApplication.mm +331 -0
  54. package/native/fabric/SolidNativeFabricSurface.h +63 -0
  55. package/native/fabric/SolidNativeFabricSurface.mm +549 -0
  56. package/native/fabric/SolidNativeFabricTransactionCoordinator.cpp +1275 -0
  57. package/native/fabric/SolidNativeFabricTransactionCoordinator.h +90 -0
  58. package/native/fabric/SolidNativeFabricTransactionCoordinatorApple.mm +97 -0
  59. package/native/fabric/SolidNativeRootViewController.h +20 -0
  60. package/native/fabric/SolidNativeRootViewController.mm +83 -0
  61. package/native/fabric/SolidNativeStagedNodeMap.h +104 -0
  62. package/native/fabric/SolidNativeStartupFailureView.h +17 -0
  63. package/native/fabric/SolidNativeStartupFailureView.mm +77 -0
  64. package/native/react-native-boundary.json +106 -0
  65. package/native/worklets/SolidNativeUIWorklet.cpp +1080 -0
  66. package/native/worklets/SolidNativeUIWorklet.h +245 -0
  67. package/package.json +41 -3
  68. package/scripts/verify-react-native-boundary.mjs +282 -0
@@ -0,0 +1,245 @@
1
+ #pragma once
2
+
3
+ #include <cstddef>
4
+ #include <cstdint>
5
+ #include <optional>
6
+ #include <string>
7
+ #include <vector>
8
+
9
+ #include <folly/dynamic.h>
10
+
11
+ namespace solid_native::worklets {
12
+
13
+ constexpr int UIWorkletProtocolVersion = 0;
14
+ constexpr size_t MaximumUIWorkletInputs = 64;
15
+ constexpr size_t MaximumUIWorkletOutputs = 64;
16
+ constexpr size_t MaximumUIWorkletExpressionDepth = 32;
17
+ constexpr size_t MaximumUIWorkletExpressionNodes = 512;
18
+ constexpr double MaximumUIWorkletTimingDurationMilliseconds = 60000;
19
+ constexpr size_t MaximumUIWorkletTimingKeyframes = 32;
20
+ constexpr size_t MaximumUIWorkletFrameIntervalSamples = 8192;
21
+ constexpr double MinimumUIWorkletSpringMass = 0.001;
22
+ constexpr double MaximumUIWorkletSpringMass = 100;
23
+ constexpr double MinimumUIWorkletSpringStiffness = 0.001;
24
+ constexpr double MaximumUIWorkletSpringStiffness = 100000;
25
+ constexpr double MaximumUIWorkletSpringDamping = 10000;
26
+ constexpr double MaximumUIWorkletSpringInitialVelocity = 100;
27
+ constexpr double MaximumUIWorkletSpringRestSpeed = 100;
28
+ constexpr double MaximumUIWorkletSpringDurationMilliseconds = 60000;
29
+ constexpr double MinimumUIWorkletDecayDeceleration = 0.001;
30
+ constexpr double MaximumUIWorkletDecayDeceleration = 1000;
31
+ constexpr double MaximumUIWorkletDecayVelocity = 100000;
32
+ constexpr double MaximumUIWorkletDecayVelocityThreshold = 10000;
33
+ constexpr double MaximumUIWorkletDecayDurationMilliseconds = 60000;
34
+
35
+ enum class UIWorkletTimingEasing {
36
+ Linear,
37
+ EaseIn,
38
+ EaseOut,
39
+ EaseInOut,
40
+ };
41
+
42
+ struct UIWorkletTiming final {
43
+ static UIWorkletTiming parse(const folly::dynamic &value);
44
+
45
+ double durationMilliseconds;
46
+ UIWorkletTimingEasing easing;
47
+
48
+ double evaluateProgress(double elapsedMilliseconds) const;
49
+ };
50
+
51
+ struct UIWorkletTimingKeyframe final {
52
+ std::vector<double> inputs;
53
+ UIWorkletTiming timing;
54
+ };
55
+
56
+ struct UIWorkletTimingSequenceSample final {
57
+ std::vector<double> inputs;
58
+ double progress;
59
+ bool settled;
60
+ };
61
+
62
+ struct UIWorkletTimingSequence final {
63
+ static UIWorkletTimingSequence parse(
64
+ const folly::dynamic &value,
65
+ size_t inputCount);
66
+
67
+ std::vector<UIWorkletTimingKeyframe> keyframes;
68
+ double totalDurationMilliseconds;
69
+
70
+ UIWorkletTimingSequenceSample evaluate(
71
+ const std::vector<double> &from,
72
+ double elapsedMilliseconds) const;
73
+ };
74
+
75
+ struct UIWorkletSpringSample final {
76
+ double position;
77
+ double velocity;
78
+ bool settled;
79
+ };
80
+
81
+ struct UIWorkletSpring final {
82
+ static UIWorkletSpring parse(const folly::dynamic &value);
83
+
84
+ double mass;
85
+ double stiffness;
86
+ double damping;
87
+ double initialVelocity;
88
+ double restSpeedThreshold;
89
+ double restDisplacementThreshold;
90
+ double maximumDurationMilliseconds;
91
+
92
+ UIWorkletSpringSample evaluate(double elapsedMilliseconds) const;
93
+ };
94
+
95
+ struct UIWorkletDecaySample final {
96
+ double displacementFactorSeconds;
97
+ double velocityFactor;
98
+ double speed;
99
+ bool settled;
100
+ };
101
+
102
+ struct UIWorkletDecay final {
103
+ static UIWorkletDecay parse(const folly::dynamic &value);
104
+
105
+ double deceleration;
106
+ double velocityThreshold;
107
+ double maximumDurationMilliseconds;
108
+
109
+ UIWorkletDecaySample evaluate(
110
+ double initialSpeed,
111
+ double elapsedMilliseconds) const;
112
+ };
113
+
114
+ std::vector<double> interpolateUIWorkletInputs(
115
+ const std::vector<double> &from,
116
+ const std::vector<double> &to,
117
+ double progress);
118
+
119
+ struct UIWorkletFrameStatisticsSnapshot final {
120
+ int64_t frameCount;
121
+ int64_t intervalCount;
122
+ size_t sampledIntervalCount;
123
+ int64_t droppedIntervalSampleCount;
124
+ double firstFrameTimeMilliseconds;
125
+ double lastFrameTimeMilliseconds;
126
+ double minimumFrameIntervalMilliseconds;
127
+ double maximumFrameIntervalMilliseconds;
128
+ double meanFrameIntervalMilliseconds;
129
+ double p50FrameIntervalMilliseconds;
130
+ double p95FrameIntervalMilliseconds;
131
+ double p99FrameIntervalMilliseconds;
132
+ };
133
+
134
+ class UIWorkletFrameStatistics final {
135
+ public:
136
+ void reset() noexcept;
137
+ void recordFrame(int64_t frameTimeNanoseconds);
138
+ bool empty() const noexcept;
139
+ UIWorkletFrameStatisticsSnapshot snapshot() const;
140
+
141
+ private:
142
+ int64_t frameCount_{0};
143
+ int64_t firstFrameTimeNanoseconds_{0};
144
+ int64_t lastFrameTimeNanoseconds_{0};
145
+ int64_t minimumFrameIntervalNanoseconds_{0};
146
+ int64_t maximumFrameIntervalNanoseconds_{0};
147
+ int64_t totalFrameIntervalNanoseconds_{0};
148
+ std::vector<int64_t> intervalSamples_;
149
+ int64_t droppedIntervalSampleCount_{0};
150
+ };
151
+
152
+ struct UIWorkletOutputValue final {
153
+ std::string name;
154
+ double value;
155
+ };
156
+
157
+ /**
158
+ * Immutable, bounded numeric program decoded from the public version-0
159
+ * transport graph. The instruction stream is platform-neutral; platform
160
+ * adapters decide which named output channels they can apply.
161
+ */
162
+ class UIWorkletGraph final {
163
+ public:
164
+ static UIWorkletGraph parse(const folly::dynamic &value);
165
+
166
+ size_t inputCount() const noexcept;
167
+ const std::vector<std::string> &inputNames() const noexcept;
168
+ const std::vector<double> &initialInputs() const noexcept;
169
+ const std::vector<std::string> &outputNames() const noexcept;
170
+
171
+ std::vector<UIWorkletOutputValue> evaluate(
172
+ const std::vector<double> &inputs) const;
173
+
174
+ /** Internal bytecode representation exposed only to the native decoder. */
175
+ enum class Operation {
176
+ Constant,
177
+ Input,
178
+ Add,
179
+ Subtract,
180
+ Multiply,
181
+ Divide,
182
+ Minimum,
183
+ Maximum,
184
+ Absolute,
185
+ Negate,
186
+ Clamp,
187
+ Interpolate,
188
+ };
189
+
190
+ struct Instruction final {
191
+ Operation operation;
192
+ size_t input{0};
193
+ double first{0};
194
+ double second{0};
195
+ double third{0};
196
+ double fourth{0};
197
+ bool clamp{false};
198
+ };
199
+
200
+ struct OutputProgram final {
201
+ std::string name;
202
+ std::vector<Instruction> instructions;
203
+ };
204
+
205
+ private:
206
+ UIWorkletGraph(
207
+ std::vector<std::string> inputNames,
208
+ std::vector<double> initialInputs,
209
+ std::vector<OutputProgram> outputs);
210
+
211
+ std::vector<std::string> inputNames_;
212
+ std::vector<double> initialInputs_;
213
+ std::vector<std::string> outputNames_;
214
+ std::vector<OutputProgram> outputs_;
215
+ };
216
+
217
+ struct UIWorkletPanGesture final {
218
+ static UIWorkletPanGesture parse(
219
+ const folly::dynamic &value,
220
+ const UIWorkletGraph &graph);
221
+
222
+ size_t xInput;
223
+ size_t yInput;
224
+ double minX;
225
+ double maxX;
226
+ double minY;
227
+ double maxY;
228
+ std::optional<UIWorkletDecay> releaseDecay;
229
+
230
+ std::vector<double> evaluateInputs(
231
+ const std::vector<double> &currentInputs,
232
+ double originX,
233
+ double originY,
234
+ double translationX,
235
+ double translationY) const;
236
+ };
237
+
238
+ enum class UIWorkletPanGesturePhase {
239
+ Begin = 0,
240
+ Change = 1,
241
+ End = 2,
242
+ Cancel = 3,
243
+ };
244
+
245
+ } // namespace solid_native::worklets
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@solidnative-dev/fabric-host",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-beta.0",
4
+ "type": "module",
5
+ "description": "Framework-neutral host adapter for the pinned React Native Fabric runtime.",
6
+ "license": "MIT",
7
+ "homepage": "https://solidnative.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/solid-native/solid-native.git",
11
+ "directory": "packages/fabric-host"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "engines": {
17
+ "node": "^22.13.0 || ^24.3.0 || >=26.0.0"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./android-gradle": "./native/android/solid-native.gradle",
25
+ "./ios-podspec": "./native/SolidNativeFabric.podspec",
26
+ "./react-native-boundary": "./native/react-native-boundary.json"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "native",
31
+ "scripts"
32
+ ],
33
+ "dependencies": {
34
+ "@react-native/normalize-colors": "0.88.1",
35
+ "@solidnative-dev/host-contract": "0.1.0-beta.0",
36
+ "@solidnative-dev/react-native-compat": "0.1.0-beta.0"
37
+ },
38
+ "scripts": {
39
+ "build": "tsc -p tsconfig.json",
40
+ "boundary:verify": "node scripts/verify-react-native-boundary.mjs",
41
+ "check": "tsc -p tsconfig.json --noEmit && pnpm boundary:verify",
42
+ "test": "pnpm build && pnpm boundary:verify && node --test test/*.test.mjs"
43
+ }
6
44
  }
@@ -0,0 +1,282 @@
1
+ import assert from "node:assert/strict";
2
+ import { readdir, readFile } from "node:fs/promises";
3
+ import { dirname, join, relative, sep } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
7
+ const nativeRoot = join(packageRoot, "native");
8
+ const manifestPath = join(nativeRoot, "react-native-boundary.json");
9
+
10
+ const reactNativeHeader =
11
+ /^(?:React\/|ReactCommon\/|React_RCTAppDelegate\/|cxxreact\/|fbjni\/|folly\/|jsi\/|react\/)/u;
12
+ const generatedCodegenHeader = /^SolidNative(?:App|E2E)Spec\//u;
13
+
14
+ async function filesBelow(directory) {
15
+ const entries = await readdir(directory, { withFileTypes: true });
16
+ const nested = await Promise.all(
17
+ entries.map(async (entry) => {
18
+ const path = join(directory, entry.name);
19
+ if (entry.isDirectory()) return filesBelow(path);
20
+ return entry.isFile() && /\.(?:cpp|h|kt|mm)$/u.test(entry.name)
21
+ ? [path]
22
+ : [];
23
+ }),
24
+ );
25
+ return nested.flat().sort();
26
+ }
27
+
28
+ function compareText(left, right) {
29
+ return left < right ? -1 : left > right ? 1 : 0;
30
+ }
31
+
32
+ function sorted(values) {
33
+ return [...values].sort(compareText);
34
+ }
35
+
36
+ function packagePath(path) {
37
+ return relative(packageRoot, path).split(sep).join("/");
38
+ }
39
+
40
+ async function supportedReactNativeVersion() {
41
+ const packageManifest = JSON.parse(
42
+ await readFile(join(packageRoot, "package.json"), "utf8"),
43
+ );
44
+ const version =
45
+ packageManifest.dependencies?.["@react-native/normalize-colors"];
46
+ assert.match(
47
+ version ?? "",
48
+ /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/u,
49
+ "Fabric Host must exactly pin its React Native normalization dependency.",
50
+ );
51
+ return version;
52
+ }
53
+
54
+ async function nativeImports() {
55
+ const headers = new Set();
56
+ const generatedHeaders = new Set();
57
+ const androidImports = new Set();
58
+ for (const path of await filesBelow(nativeRoot)) {
59
+ const source = await readFile(path, "utf8");
60
+ for (const match of source.matchAll(
61
+ /^\s*#(?:include|import)\s*[<"]([^>"]+)[>"]/gmu,
62
+ )) {
63
+ const specifier = match[1];
64
+ if (reactNativeHeader.test(specifier)) headers.add(specifier);
65
+ if (generatedCodegenHeader.test(specifier)) {
66
+ generatedHeaders.add(specifier);
67
+ }
68
+ }
69
+ for (const match of source.matchAll(
70
+ /^\s*import\s+(com\.facebook\.[^\s]+)\s*$/gmu,
71
+ )) {
72
+ androidImports.add(match[1]);
73
+ }
74
+ }
75
+ return {
76
+ nativeHeaders: sorted(headers),
77
+ generatedCodegenHeaders: sorted(generatedHeaders),
78
+ androidImports: sorted(androidImports),
79
+ };
80
+ }
81
+
82
+ async function podDependencies(reactNativeVersion) {
83
+ const source = await readFile(
84
+ join(nativeRoot, "SolidNativeFabric.podspec"),
85
+ "utf8",
86
+ );
87
+ return [
88
+ ...source.matchAll(/spec\.dependency\s+"([^"]+)"(?:,\s*"([^"]+)")?/gu),
89
+ ]
90
+ .map((match) => ({
91
+ name: match[1],
92
+ version:
93
+ match[2] === "= #{react_native_release}"
94
+ ? `= ${reactNativeVersion}`
95
+ : (match[2] ?? null),
96
+ }))
97
+ .sort((left, right) => compareText(left.name, right.name));
98
+ }
99
+
100
+ async function androidCmakeInputs() {
101
+ const source = await readFile(
102
+ join(nativeRoot, "android/SolidNativeRuntime.cmake"),
103
+ "utf8",
104
+ );
105
+ return {
106
+ reactNativeIncludeDirectories: sorted(
107
+ new Set(
108
+ [...source.matchAll(/"(\$\{REACT_ANDROID_DIR\}[^"]*)"/gu)].map(
109
+ (match) => match[1],
110
+ ),
111
+ ),
112
+ ),
113
+ inheritedCompileOptions: source.includes("${folly_FLAGS}")
114
+ ? ["${folly_FLAGS}"]
115
+ : [],
116
+ };
117
+ }
118
+
119
+ async function boundarySnapshot() {
120
+ const reactNativeVersion = await supportedReactNativeVersion();
121
+ const imports = await nativeImports();
122
+ const snapshot = {
123
+ schemaVersion: 1,
124
+ reactNativeVersion,
125
+ ...imports,
126
+ cocoapods: await podDependencies(reactNativeVersion),
127
+ androidCmake: await androidCmakeInputs(),
128
+ };
129
+
130
+ const apiHeader = await readFile(
131
+ join(nativeRoot, "fabric/SolidNativeFabricApi.h"),
132
+ "utf8",
133
+ );
134
+ assert.match(
135
+ apiHeader,
136
+ /ReactNativeVersion\s*=\s*\n?\s*SOLID_NATIVE_REACT_NATIVE_RUNTIME_VERSION/u,
137
+ "The Fabric adapter must publish the manifest-selected runtime identity.",
138
+ );
139
+ for (const part of ["MAJOR", "MINOR", "PATCH"]) {
140
+ assert.match(
141
+ apiHeader,
142
+ new RegExp(
143
+ `REACT_NATIVE_VERSION_${part} != SOLID_NATIVE_REACT_NATIVE_VERSION_${part}`,
144
+ "u",
145
+ ),
146
+ `The Fabric adapter does not guard the ${part.toLowerCase()} React Native version part.`,
147
+ );
148
+ }
149
+ const podspec = await readFile(
150
+ join(nativeRoot, "SolidNativeFabric.podspec"),
151
+ "utf8",
152
+ );
153
+ assert.match(
154
+ podspec,
155
+ /react-native-boundary\.json[\s\S]*GCC_PREPROCESSOR_DEFINITIONS/u,
156
+ "The iOS build does not derive its compile guard from the boundary manifest.",
157
+ );
158
+ const androidGradle = await readFile(
159
+ join(nativeRoot, "android/solid-native.gradle"),
160
+ "utf8",
161
+ );
162
+ for (const part of ["MAJOR", "MINOR", "PATCH"]) {
163
+ assert.match(
164
+ androidGradle,
165
+ new RegExp(`-DSOLID_NATIVE_REACT_NATIVE_VERSION_${part}=`, "u"),
166
+ `The Android build does not pass the ${part.toLowerCase()} boundary version to CMake.`,
167
+ );
168
+ }
169
+ for (const dependency of snapshot.cocoapods) {
170
+ if (dependency.version === null) continue;
171
+ assert.equal(
172
+ dependency.version,
173
+ `= ${reactNativeVersion}`,
174
+ `CocoaPods dependency ${dependency.name} is not pinned to React Native ${reactNativeVersion}.`,
175
+ );
176
+ }
177
+ assert.ok(
178
+ snapshot.androidCmake.reactNativeIncludeDirectories.length > 0,
179
+ "The Android adapter does not declare its React Native CMake include roots.",
180
+ );
181
+ for (const applicationSource of [
182
+ "SolidNativeFabricApplication.mm",
183
+ "SolidNativeFabricSmokeApplication.mm",
184
+ ]) {
185
+ const source = await readFile(
186
+ join(nativeRoot, "fabric", applicationSource),
187
+ "utf8",
188
+ );
189
+ const interopIndex = source.indexOf("RCTEnableTurboModuleInterop(YES)");
190
+ const hostIndex = source.indexOf("[[RCTHost alloc]");
191
+ assert.ok(
192
+ interopIndex >= 0 && hostIndex > interopIndex,
193
+ `${applicationSource} must enable bridgeless legacy-module interop before RCTHost snapshots registered modules.`,
194
+ );
195
+ }
196
+ const productionApplication = await readFile(
197
+ join(nativeRoot, "fabric/SolidNativeFabricApplication.mm"),
198
+ "utf8",
199
+ );
200
+ assert.match(
201
+ productionApplication,
202
+ /hostDidStart:[\s\S]*markSurfaceReloading[\s\S]*dispatch_async\(dispatch_get_main_queue\(\)[\s\S]*rebindToCurrentHostAfterJSRuntimeReload[\s\S]*prepareSurfaceForJSIOwnership/u,
203
+ "The iOS host must hide and republish its empty Fabric surface around a development runtime reload.",
204
+ );
205
+ const productionBinding = await readFile(
206
+ join(nativeRoot, "fabric/SolidNativeFabricJSIBinding.mm"),
207
+ "utf8",
208
+ );
209
+ assert.match(
210
+ productionBinding,
211
+ /installEmptySurfaceStopCompatibility[\s\S]*RN\$stopSurface[\s\S]*isUndefined\(\)[\s\S]*createFromHostFunction/u,
212
+ "The iOS binding must preserve a renderer-owned stop hook and complete React Native's missing empty-surface stop lifecycle.",
213
+ );
214
+ const productionSurface = await readFile(
215
+ join(nativeRoot, "fabric/SolidNativeFabricSurface.mm"),
216
+ "utf8",
217
+ );
218
+ assert.match(
219
+ productionSurface,
220
+ /initWithSurfacePresenter:host\.surfacePresenter[\s\S]*moduleName:@""/u,
221
+ "The package-owned empty iOS surface must have one explicit start owner.",
222
+ );
223
+ assert.doesNotMatch(
224
+ productionSurface,
225
+ /\[host createSurfaceWithModuleName:/u,
226
+ "The package-owned empty iOS surface must not inherit RCTHost's second buffered start.",
227
+ );
228
+ assert.match(
229
+ productionSurface,
230
+ /SolidNativeFabricContainerView[\s\S]*layoutSubviews[\s\S]*updateLayoutConstraintsForView:self[\s\S]*didMoveToWindow[\s\S]*updateLayoutConstraintsForView:self/u,
231
+ "The package-owned iOS view must forward UIKit size and window changes into its Fabric surface.",
232
+ );
233
+ assert.match(
234
+ productionSurface,
235
+ /SolidNativeFabricContainerView[\s\S]*traitCollectionDidChange:[\s\S]*RCTUserInterfaceStyleDidChangeNotification[\s\S]*RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey/u,
236
+ "The package-owned iOS view must forward UIKit trait changes into React Native's Appearance module.",
237
+ );
238
+ assert.match(
239
+ productionSurface,
240
+ /updateLayoutConstraintsForView:[\s\S]*setMinimumSize:size[\s\S]*maximumSize:size[\s\S]*viewportOffset:viewportOffset/u,
241
+ "The package-owned iOS surface must keep Fabric root constraints aligned with its current UIKit viewport.",
242
+ );
243
+ const emptyOwnership = productionSurface.indexOf(
244
+ "prepareEmptySurfaceForJSIOwnershipWithCompletion",
245
+ );
246
+ const emptyStart = productionSurface.indexOf(
247
+ "[_surface start]",
248
+ emptyOwnership,
249
+ );
250
+ const surfaceViewSynchronization = productionSurface.indexOf(
251
+ "[self synchronizeSurfaceView]",
252
+ emptyOwnership,
253
+ );
254
+ const emptyTransaction = productionSurface.indexOf(
255
+ "NSDictionary<NSString *, id> *transaction",
256
+ emptyOwnership,
257
+ );
258
+ assert.ok(
259
+ emptyOwnership >= 0 &&
260
+ surfaceViewSynchronization > emptyOwnership &&
261
+ emptyStart > emptyOwnership &&
262
+ emptyStart > surfaceViewSynchronization &&
263
+ emptyTransaction > emptyStart,
264
+ "The package-owned empty iOS surface must replace RN's reset view and start without waiting for AppRegistry or JavaScript bundle completion.",
265
+ );
266
+ return snapshot;
267
+ }
268
+
269
+ const snapshot = await boundarySnapshot();
270
+ if (process.argv.includes("--print")) {
271
+ process.stdout.write(`${JSON.stringify(snapshot, null, 2)}\n`);
272
+ } else {
273
+ const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
274
+ assert.deepEqual(
275
+ manifest,
276
+ snapshot,
277
+ `${packagePath(manifestPath)} does not match the native React Native dependency surface. Run this verifier with --print, review every upstream boundary change, and update the manifest deliberately.`,
278
+ );
279
+ console.log(
280
+ `Verified the React Native ${snapshot.reactNativeVersion} native boundary: ${snapshot.nativeHeaders.length} headers, ${snapshot.androidImports.length} Android imports, and ${snapshot.cocoapods.length} CocoaPods dependencies.`,
281
+ );
282
+ }