@solidnative-dev/runtime 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Solid Native contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,348 @@
1
- # Temporary Holding Version
1
+ # `@solidnative-dev/runtime`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The TypeScript runtime applies the framework-neutral host contract's capability
4
+ and component validation before mounting an application. Its React Native 0.88
5
+ integration composes `@solidnative-dev/fabric-host` with the Solid renderer. Fabric
6
+ Host implements the same `NativeHost` contract as the in-memory backend; this
7
+ package retains the compatible Solid owner and application-bootstrap facade.
8
+
9
+ On Android, the package-owned surface also resolves the Activity's effective
10
+ application locale immediately before Fabric surface creation and synchronizes
11
+ React Native 0.87's package-scoped RTL preferences. This contains an upstream
12
+ natural-RTL defect—0.87 consults an arbitrary available locale—inside the
13
+ version-pinned backend so Activity configuration, `I18nManager` constants, and
14
+ Yoga layout agree without a JavaScript mutation facade.
15
+
16
+ ```ts
17
+ const report = inspectHost(host, {
18
+ components: ["RootView", "View", "Text"],
19
+ capabilities: ["bubblingEvents"],
20
+ });
21
+
22
+ const app = startApplication(() => App(), host, {
23
+ surface: { name: "main" },
24
+ });
25
+ ```
26
+
27
+ `startApplication` preserves a synchronous bootstrap for hosts whose surface
28
+ cleanup is synchronous. If the initial Solid render fails, it starts background
29
+ surface rollback before rethrowing the original error. Use
30
+ `await startApplicationAsync(...)` when an asynchronous host requires a
31
+ transactional boundary: failure is not reported until native rollback has
32
+ settled, and independent render and cleanup failures are retained together.
33
+
34
+ The first backend is now pinned to React Native 0.88.1 and Hermes
35
+ 260318099.0.5 (HBC 99). Its empty-surface bootstrap, direct Fabric mount, and clone-based
36
+ text update run in an iOS simulator without a React component render. JSI
37
+ host-contract transport now runs synchronously from Hermes into that surface;
38
+ the compiled boundary also routes normalized subscribed events through the
39
+ Solid-owned parent graph and reads current-revision layout. Signed physical
40
+ iPhone and Pixel Release proofs cover press delivery, signal-driven commits,
41
+ measurement, identity reclamation, and empty-surface stop. Both use the
42
+ checked-in `apps/native-e2e` shell. The Android JNI installer, Kotlin
43
+ `BindingsInstaller`, portable transaction coordinator, and CMake integration
44
+ are package-owned under `native/android`. The exported `./android-gradle`
45
+ integration configures the installed Kotlin and CMake paths without assuming a
46
+ node_modules layout. The package-owned `SolidNativeSurface` now owns empty
47
+ surface publication, native UI-worklet handlers, and acknowledged teardown;
48
+ the app supplies its ordinary React Native host and Activity callbacks. Android therefore shares the portable
49
+ transaction coordinator rather than maintaining a second logical renderer. The React-free
50
+ bundle resolves the native `PlatformConstants` TurboModule through React
51
+ Native's standard registry, verifies its 0.88.1 fingerprint, and awaits the
52
+ platform Linking module's initial-URL promise before mounting. A native
53
+ AppState lifecycle event must also reach Hermes before the press proof can
54
+ complete. On Pixel, core's platform-event wrapper retains that TurboModule
55
+ delivery as the input cause of the exact Solid/Fabric lifecycle commit, mount,
56
+ and next frame without recording the lifecycle payload. Those paths now enter
57
+ through the validated
58
+ `@solidnative-dev/runtime/react-native` platform service rather than application
59
+ imports of React Native internals. That service also reads current keyboard
60
+ metrics, validates native show/hide geometry, combines both platform listeners
61
+ behind one idempotent subscription, and exposes dismissal without leaking React
62
+ Native event shapes into portable code. Window dimensions use the same boundary:
63
+ the service validates finite logical width, height, display scale, and font scale,
64
+ then follows rotation, resizing, and foldable-window changes through one removable
65
+ subscription. The same shell registers a TypeScript Codegen spec, mounts its custom
66
+ native view through the public component factory/descriptor helpers, and
67
+ measures it on both devices. See
68
+ [`native/README.md`](native/README.md) and the repository's Fabric spike record.
69
+ The package allowlist includes that reviewed native directory alongside the
70
+ compiled JavaScript. Repository CI packs the real artifact and requires its
71
+ podspec, portable C++ coordinator, iOS JSI binding, Android CMake seam, JNI
72
+ installer, Kotlin bridge, exported Gradle integration, and exported iOS podspec
73
+ to be present and resolvable before a source-only workspace build can pass.
74
+
75
+ Android shells that enable the native screen stack extend
76
+ `androidx.appcompat.app.AppCompatActivity` and use a no-action-bar AppCompat
77
+ theme. The pinned `RNSScreenStackHeaderConfig` installs its platform toolbar
78
+ through `setSupportActionBar`; a plain `FragmentActivity` is sufficient for
79
+ screens alone but cannot host native stack headers.
80
+
81
+ The transaction snapshot processes style and direct color props into React
82
+ Native's `0xaarrggbb` transport representation, including the Switch facade's
83
+ internal false/true track colors. The native coordinator then resolves the
84
+ portable Switch descriptor, prop aliases, `valueChange` route, and platform
85
+ command name. A controlled rollback is command-only: it advances the renderer
86
+ sequence and participates in `flush()`, but correctly produces no structural
87
+ Fabric revision or mount lifecycle event.
88
+
89
+ Ordinary props remain bounded, transport-safe `HostValue` data. Native
90
+ components that genuinely require an object identity, such as VisionCamera's
91
+ preview output, use a separate direct-prop resource contract:
92
+
93
+ ```ts
94
+ const resource = retainOwnedNativeResource(
95
+ binding,
96
+ "vision-camera.preview-output",
97
+ previewOutput,
98
+ );
99
+
100
+ // Valid only as the complete value of one direct native prop.
101
+ const previewOutputProp = resource.reference;
102
+ ```
103
+
104
+ The binding retains the exact non-array JSI object in a surface/runtime-scoped
105
+ registry capped at 64 entries. The transaction transports only a frozen typed
106
+ handle and kind; RawProps resolution restores the original object identity.
107
+ Nested markers are never resolved, unknown or mismatched handles fail the
108
+ commit, and Solid owner cleanup releases the registry entry. Surface handoff
109
+ and destroy both reject leaked resources.
110
+
111
+ Fabric Host's `createNativeHostTransaction(commit, platform)` stamps contract
112
+ version 1, applies the platform's signed or unsigned processed-color contract,
113
+ and deep-copies the renderer commit into the exact transport-safe envelope
114
+ consumed by the native coordinator. `getNativeHostBinding()` verifies the pinned JSI fingerprint,
115
+ `readNativeSurfaceInfo()` reads its native-owned surface,
116
+ `commitNativeHostTransaction()` snapshots and checks a synchronous commit,
117
+ `subscribeToNativeHostCommitLifecycle()` validates exact revision-mount events,
118
+ and `measureNativeHostNode()` validates sequence-aware layout results. A
119
+ renderer commit's opaque causal operation ID crosses the JSI transaction;
120
+ structural commits return their Fabric revision and later report its observed
121
+ platform mount, while command-only commits do neither.
122
+
123
+ Contract version 1 also requires the native binding and its host adapter to
124
+ report a stable `android` or `ios` platform identifier. Component facades use
125
+ that host-owned fact only where the underlying platform lifecycle genuinely
126
+ differs, notably Modal dismissal; applications do not need to import React
127
+ Native's `Platform` module.
128
+
129
+ The adapter also normalizes semantic scheduling where React Native's raw event
130
+ category is backend-dependent. In particular, drag start/end are discrete
131
+ input boundaries even though React Native 0.87 emits Android
132
+ `scrollEndDrag` through the unspecified generic event category; ordinary
133
+ `scroll` remains continuous. The dedicated Android VirtualizedList proof caught
134
+ and now guards this distinction on a physical Release build.
135
+
136
+ Application disposal is also an acknowledged platform boundary. The Android
137
+ binding requests package-owned `ReactSurface.stop/clear/detach` work on the main
138
+ thread. Native work is deactivated immediately, while surface publication is
139
+ retained until React Native's bounded asynchronous stop task completes, so the
140
+ host keeps the surface in a destroying state and rejects new work until
141
+ `getSurfaceInfo()` reports it gone. Consequently, `await app.dispose()` now
142
+ means Solid owners and Fabric identities were reclaimed and React Native
143
+ completed the stop, rather than only that Android's stop work was queued.
144
+
145
+ Development runtime replacement is a separate non-terminal boundary. Metro is
146
+ configured to reload application modules instead of passing Solid component
147
+ exports through React Refresh. When React Native replaces Hermes while retaining
148
+ its platform surface, both bindings cancel the retired runtime's native work,
149
+ detach its event/mount observers, discard its transaction coordinator graph,
150
+ and give the replacement runtime fresh event routing plus node and sequence
151
+ identity. This prevents stale Solid owners, worklets, or coordinator nodes from
152
+ crossing a reload without stopping the application-owned surface itself.
153
+
154
+ The backend-specific platform service keeps React Native 0.87 implementation
155
+ paths behind one subpath export. It validates the native-module version and
156
+ platform once, narrows untrusted initial-URL/AppState/link/window/appearance
157
+ payloads, and returns idempotent subscriptions for lifecycle, running-process
158
+ links, cross-platform memory warnings, window and color-scheme changes, and
159
+ Android hardware Back. Android memory pressure enters through the
160
+ package-owned `SolidNativePlatformAndroid` TurboModule because React Native
161
+ 0.87's Android AppState module does not emit it. It also
162
+ validates bounded, scheme-qualified outbound URLs before calling the pinned
163
+ Linking TurboModule directly, exposes boolean `canOpenURL`, and opens the
164
+ application's system-settings page without evaluating `Linking.js`. For
165
+ status-bar control, it owns a validated property-merging stack without
166
+ evaluating React Native's React `StatusBar` component: on iOS scenes hosted by
167
+ `SolidNativeRootViewController` (`UIViewControllerBasedStatusBarAppearance=true`),
168
+ it routes updates directly through the host JSI binding (`setStatusBarStyle` /
169
+ `setStatusBarHidden`) so status-bar control works on iOS 27+ where legacy
170
+ `UIApplication` status-bar APIs are no-ops; Android and legacy hosts use
171
+ `StatusBarManager` through the TurboModule registry. The portable factory
172
+ accepts an injected adapter for deterministic tests; application bundles use the
173
+ pinned adapter after `react-native/setup-env`:
174
+
175
+ Android applications generated by the CLI forward Activity configuration
176
+ changes to `ReactHost`. This is required by React Native's bridgeless host for
177
+ system appearance delivery; handling `uiMode` in the manifest without that
178
+ callback updates Android resources but leaves Hermes and Solid stale.
179
+
180
+ ```ts
181
+ import {
182
+ createAppState,
183
+ createColorScheme,
184
+ createMemoryWarningCount,
185
+ StatusBar,
186
+ createWindowDimensions,
187
+ } from "@solidnative-dev/core";
188
+ import { getReactNativePlatformServices } from "@solidnative-dev/runtime/react-native";
189
+
190
+ const platform = getReactNativePlatformServices();
191
+ const initialURL = await platform.getInitialURL();
192
+ if (await platform.canOpenURL("https://solidjs.com")) {
193
+ await platform.openURL("https://solidjs.com");
194
+ }
195
+ await platform.openSettings();
196
+ const appState = createAppState(platform);
197
+ const memoryWarnings = createMemoryWarningCount(platform);
198
+ const colorScheme = createColorScheme(platform);
199
+ const window = createWindowDimensions(platform);
200
+ // appState() is a Solid accessor; its causal native subscription follows the owner.
201
+ // memoryWarnings() increments for each native warning on iOS and Android.
202
+ // colorScheme() is "light" or "dark" and updates at the same ownership boundary.
203
+ // window.width(), height(), scale(), and fontScale() update independently.
204
+
205
+ platform.setColorSchemeOverride("dark");
206
+ platform.setColorSchemeOverride("system"); // Resume following the device setting.
207
+
208
+ <StatusBar source={platform} barStyle="auto" hidden={false} />;
209
+ ```
210
+
211
+ The physical iOS gate builds a signed Release app and posts UIKit's exact
212
+ memory-warning notification through a compile-time-only E2E URL after XCTest
213
+ observes the owned subscription's initial native output:
214
+
215
+ ```sh
216
+ SOLID_NATIVE_IOS_DESTINATION=<CoreDevice-id> \
217
+ SOLID_NATIVE_IOS_TEAM=<development-team> \
218
+ pnpm --filter @solidnative-dev/native-e2e ios:memory-warning:test
219
+ ```
220
+
221
+ It requires the complete UIKit notification → `RCTAppState` → Hermes → Solid
222
+ computation → Fabric commit → mount → frame chain and owner teardown. The proof
223
+ route is not compiled into ordinary builds. This verifies native delivery on
224
+ hardware, not OS-generated pressure or jetsam behavior.
225
+
226
+ The Android gate uses the generated application's exact `onTrimMemory` entry,
227
+ then requires `SolidNativePlatformAndroid` → Hermes → Solid computation → Fabric
228
+ commit → mount → frame → teardown on a physical Pixel:
229
+
230
+ ```sh
231
+ pnpm --filter @solidnative-dev/native-e2e android:memory-warning:test
232
+ ```
233
+
234
+ It injects `RUNNING_CRITICAL` deterministically on the device main thread; it
235
+ does not claim to force genuine system-wide low memory. `UI_HIDDEN` remains a
236
+ visibility transition and is deliberately not converted into a warning.
237
+
238
+ ```ts
239
+ const binding = getNativeHostBinding();
240
+ const app = await startNativeApplication(() => App(), {
241
+ binding,
242
+ descriptors: CORE_COMPONENT_DESCRIPTORS,
243
+ surface: { name: "main" },
244
+ });
245
+ ```
246
+
247
+ `startNativeApplication` waits at most ten seconds for the package-owned shell
248
+ to publish its empty surface, then creates the pinned Fabric adapter and mounts
249
+ the Solid root. The timeout and polling interval are bounded and configurable;
250
+ a failed native launch cannot leave an unbounded JavaScript timer behind. The
251
+ bootstrap uses the renderer's asynchronous mount boundary, so root allocation,
252
+ initial-prop validation, subscription installation, or a synchronous initial
253
+ Solid render failure is not reported until the claimed native surface has
254
+ completed teardown and released its host lease. If construction and rollback
255
+ both fail, the rejection retains both causes.
256
+
257
+ Normal shutdown follows the same rule. Event and mount-lifecycle subscriptions
258
+ are detached independently, and a failure in either does not bypass the native
259
+ surface stop. Multiple distinct cleanup failures are returned as one
260
+ `AggregateError`; the same underlying native failure observed at more than one
261
+ layer retains its original identity.
262
+
263
+ The native binding also exposes a bounded terminal-error handoff. The runtime
264
+ uses it automatically when a Fabric commit becomes permanently failed.
265
+ `startNativeApplication` also installs the `ErrorUtils` bridge for fatal Hermes
266
+ exceptions by default and owns it for exactly the returned application's
267
+ lifetime. Failed startup and `dispose()` both restore the preceding global
268
+ handler, without overwriting a newer owner. Specialized shells may pass
269
+ `fatalErrorHandler: false`; custom bootstrap code can still call
270
+ `installReactNativeFatalErrorHandler({ binding })` directly. A successful
271
+ handoff stops the live surface and lets the package-owned shell render its
272
+ dependency-free fallback; non-fatal errors remain with the preceding React
273
+ Native handler. If native takeover itself fails, the bridge synchronously
274
+ invokes the preceding platform fatal handler. Only a sanitized error name and
275
+ message cross the binding—never a stack or arbitrary thrown object—and Release
276
+ UI remains generic.
277
+
278
+ The current global is deliberately private (`__solidNativeHost`) and exposes
279
+ only surface info, terminal-error reporting, event and commit-lifecycle
280
+ attachment, bounded native resource retain/release, measurement, commit, and
281
+ guarded destroy primitives.
282
+ `NativeFabricHost` is the public-contract adapter for the one empty surface
283
+ handed off by the application shell. It owns JavaScript node allocation and
284
+ event fan-out, rejects a dirty ownership handoff, and refuses teardown while
285
+ logical nodes remain. After the renderer deletes its logical tree, the adapter
286
+ waits for the retiring Fabric revision to release every JSI instance identity
287
+ before it crosses the guarded destroy boundary. Native surface creation is
288
+ still shell-owned. React Native 0.87 does not install `RN$stopSurface` for
289
+ `startEmptySurface`, so the pinned binding supplies the no-op React half of
290
+ that stop contract only when the global is absent.
291
+
292
+ ## Intended scope
293
+
294
+ - Start Hermes and install JSI bindings
295
+ - Create/destroy application surfaces
296
+ - Implement the host contract over selected React Native/Fabric internals
297
+ - Coordinate JavaScript, commit/layout, and UI threads
298
+ - Register core component descriptors
299
+ - Bootstrap TurboModules and generated native components
300
+ - Report runtime fingerprints and capabilities
301
+ - Isolate all React Native-version-specific code
302
+
303
+ The first feasibility experiment belongs here. No API should be declared stable until native nodes can be mounted and updated without React rendering the application.
304
+
305
+ ## Native causal-debug transport
306
+
307
+ Debuggable Android and iOS applications can expose one bounded causal snapshot
308
+ through the package-owned `SolidNativeDebug` TurboModule. React Native 0.87
309
+ Codegen owns its typed `onSnapshotRequest` EventEmitter and readiness method.
310
+ On Android it generates `NativeSolidNativeDebugSpec` in the
311
+ `dev.solidnative.runtime` Java package and `SolidNativePackage()` must be in the
312
+ host package list. On iOS, the app Codegen provider maps `SolidNativeDebug` to
313
+ `SolidNativeDebugModule`, while AppDelegate routes CoreDevice payload URLs to
314
+ `SolidNativeDebugRequest`. The CLI scaffold installs all of these contracts.
315
+
316
+ ```ts
317
+ import {
318
+ createCausalTelemetry,
319
+ createCausalTimeline,
320
+ } from "@solidnative-dev/observability";
321
+ import { createReactNativeCausalDebugTransport } from "@solidnative-dev/runtime/react-native-causal-debug";
322
+ import { createDevelopmentSolidDiagnosticsController } from "@solidnative-dev/devtools/solid-diagnostics";
323
+
324
+ const timeline = createCausalTimeline({ capacity: 2_000 });
325
+ const telemetry = createCausalTelemetry({ sink: timeline.sink });
326
+ createReactNativeCausalDebugTransport(timeline, {
327
+ solidDiagnostics: createDevelopmentSolidDiagnosticsController(),
328
+ });
329
+ ```
330
+
331
+ Pass `telemetry` to `startNativeApplication`. Android registers a non-exported
332
+ receiver; iOS accepts a bundle-targeted CoreDevice payload URL. Both transports
333
+ accept only bounded nonce-bound requests while the typed Hermes listener is
334
+ ready and atomically write the matching response into app-private cache
335
+ storage. Android non-debuggable builds and ordinary iOS store Release builds
336
+ are inert. Neither platform opens a socket, polls in the background, nor
337
+ uploads telemetry.
338
+
339
+ The same nonce mailbox carries versioned `causal-snapshot`,
340
+ `solid-diagnostics-begin`, `solid-diagnostics-end`, and `tree-snapshot`
341
+ operations. Metro maps the diagnostics controller to Solid's development runtime
342
+ only in development bundles; production receives an inert shim. Diagnostics and
343
+ UI tree responses are capped at 1 MiB, strictly parsed by the CLI, and
344
+ intentionally exclude values, messages, stacks, owner IDs, prop values, text
345
+ content, and rendered user data. Pass `snapshotTree: () => root.snapshotTree()`
346
+ to `createReactNativeCausalDebugTransport` to expose live structural tree
347
+ inspection via `solid-native debug tree-android`, `tree-ios`, and
348
+ `tree-inspect`.
@@ -0,0 +1,36 @@
1
+ import { type NativeComponentDescriptor, type NativeHost, type HostRequirements } from "@solidnative-dev/host-contract";
2
+ import { type NativeApplication, type NativeRootOptions } from "@solidnative-dev/renderer";
3
+ import { type NativeFabricBinding, type ReactNativeFatalErrorHandlerOptions, type RetainedNativeResource } from "@solidnative-dev/fabric-host";
4
+ export * from "@solidnative-dev/fabric-host";
5
+ export { IncompatibleHostError, assertCompatibleHost, inspectHost, type HostCapabilityName, type HostRequirements, type HostValidationReport, type NativeHostFingerprint, type RuntimeFingerprint, } from "@solidnative-dev/host-contract";
6
+ export { NATIVE_PLATFORM_MAX_URL_LENGTH, createNativePlatformServices, type NativeAppState, type NativeColorScheme, type NativeColorSchemeOverride, type NativeKeyboardMetrics, type NativeKeyboardState, type NativePlatformFingerprint, type NativePlatformServices, type NativePlatformServicesAdapter, type NativeStatusBarAnimation, type NativeStatusBarConfiguration, type NativeStatusBarStackEntry, type NativeStatusBarStyle, type NativeSubscription, type NativeURLEvent, type NativeWindowMetrics, } from "./platform-services.js";
7
+ export interface StartApplicationOptions extends NativeRootOptions {
8
+ readonly requirements?: HostRequirements;
9
+ }
10
+ export interface StartNativeApplicationOptions extends StartApplicationOptions {
11
+ readonly binding?: NativeFabricBinding;
12
+ readonly descriptors: readonly NativeComponentDescriptor[];
13
+ /**
14
+ * Owns React Native's fatal Hermes bridge for the exact application lifetime.
15
+ * Defaults to the global ErrorUtils bridge when native fatal reporting exists.
16
+ * Set false only when a custom shell owns that global slot.
17
+ */
18
+ readonly fatalErrorHandler?: false | Omit<ReactNativeFatalErrorHandlerOptions, "binding">;
19
+ readonly surfaceReadyTimeoutMs?: number;
20
+ readonly surfaceReadyPollIntervalMs?: number;
21
+ }
22
+ /** Retains an opaque Fabric prop resource until the current Solid owner is disposed. */
23
+ export declare function retainOwnedNativeResource<Kind extends string>(binding: NativeFabricBinding, kind: Kind, value: object): RetainedNativeResource<Kind>;
24
+ export declare function startApplication(code: () => unknown, host: NativeHost, options: StartApplicationOptions): NativeApplication;
25
+ /**
26
+ * Starts a backend-neutral application and waits for surface rollback before
27
+ * reporting an initial Solid render failure.
28
+ */
29
+ export declare function startApplicationAsync(code: () => unknown, host: NativeHost, options: StartApplicationOptions): Promise<NativeApplication>;
30
+ /**
31
+ * Performs the complete JavaScript side of native startup: wait for ownership
32
+ * transfer, create the version-pinned Fabric adapter, validate requirements,
33
+ * and mount the Solid root.
34
+ */
35
+ export declare function startNativeApplication(code: () => unknown, options: StartNativeApplicationOptions): Promise<NativeApplication>;
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAQL,KAAK,mBAAmB,EACxB,KAAK,mCAAmC,EACxC,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AAGtC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAED,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC3D;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EACzB,KAAK,GAAG,IAAI,CAAC,mCAAmC,EAAE,SAAS,CAAC,CAAC;IAC/D,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;CAC9C;AAED,wFAAwF;AACxF,wBAAgB,yBAAyB,CAAC,IAAI,SAAS,MAAM,EAC3D,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,GACZ,sBAAsB,CAAC,IAAI,CAAC,CAI9B;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,OAAO,EACnB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,uBAAuB,GAC/B,iBAAiB,CAGnB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,OAAO,EACnB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAG5B;AAaD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,OAAO,EACnB,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,iBAAiB,CAAC,CA6D5B"}
package/dist/index.js ADDED
@@ -0,0 +1,94 @@
1
+ import { assertCompatibleHost, } from "@solidnative-dev/host-contract";
2
+ import { mount, mountAsync, } from "@solidnative-dev/renderer";
3
+ import { createNativeFabricHost, getNativeHostBinding, installReactNativeFatalErrorHandler, reportNativeFatalError, retainNativeResource, supportsNativeFatalErrorReporting, waitForNativeSurface, } from "@solidnative-dev/fabric-host";
4
+ import { onCleanup } from "solid-js";
5
+ export * from "@solidnative-dev/fabric-host";
6
+ export { IncompatibleHostError, assertCompatibleHost, inspectHost, } from "@solidnative-dev/host-contract";
7
+ export { NATIVE_PLATFORM_MAX_URL_LENGTH, createNativePlatformServices, } from "./platform-services.js";
8
+ /** Retains an opaque Fabric prop resource until the current Solid owner is disposed. */
9
+ export function retainOwnedNativeResource(binding, kind, value) {
10
+ const resource = retainNativeResource(binding, kind, value);
11
+ onCleanup(() => resource.release());
12
+ return resource;
13
+ }
14
+ export function startApplication(code, host, options) {
15
+ assertApplicationHost(host, options);
16
+ return mount(code, host, options);
17
+ }
18
+ /**
19
+ * Starts a backend-neutral application and waits for surface rollback before
20
+ * reporting an initial Solid render failure.
21
+ */
22
+ export async function startApplicationAsync(code, host, options) {
23
+ assertApplicationHost(host, options);
24
+ return mountAsync(code, host, options);
25
+ }
26
+ function assertApplicationHost(host, options) {
27
+ const rootComponent = options.rootComponent ?? "RootView";
28
+ assertCompatibleHost(host, {
29
+ ...options.requirements,
30
+ components: [rootComponent, ...(options.requirements?.components ?? [])],
31
+ });
32
+ }
33
+ /**
34
+ * Performs the complete JavaScript side of native startup: wait for ownership
35
+ * transfer, create the version-pinned Fabric adapter, validate requirements,
36
+ * and mount the Solid root.
37
+ */
38
+ export async function startNativeApplication(code, options) {
39
+ const { binding = getNativeHostBinding(), descriptors, fatalErrorHandler: fatalErrorHandlerOptions, surfaceReadyTimeoutMs, surfaceReadyPollIntervalMs, ...applicationOptions } = options;
40
+ const supportsFatalErrorReporting = supportsNativeFatalErrorReporting(binding);
41
+ const fatalErrorHandler = supportsFatalErrorReporting && fatalErrorHandlerOptions !== false
42
+ ? installReactNativeFatalErrorHandler({
43
+ binding,
44
+ ...(fatalErrorHandlerOptions ?? {}),
45
+ })
46
+ : undefined;
47
+ try {
48
+ await waitForNativeSurface({
49
+ binding,
50
+ ...(surfaceReadyTimeoutMs === undefined
51
+ ? {}
52
+ : { timeoutMs: surfaceReadyTimeoutMs }),
53
+ ...(surfaceReadyPollIntervalMs === undefined
54
+ ? {}
55
+ : { pollIntervalMs: surfaceReadyPollIntervalMs }),
56
+ });
57
+ const host = createNativeFabricHost({ binding, descriptors });
58
+ const applicationCommitError = applicationOptions.onCommitError;
59
+ const nativeApplicationOptions = {
60
+ ...applicationOptions,
61
+ ...(supportsFatalErrorReporting
62
+ ? {
63
+ onCommitError(error) {
64
+ try {
65
+ reportNativeFatalError(binding, error);
66
+ }
67
+ finally {
68
+ applicationCommitError?.(error);
69
+ }
70
+ },
71
+ }
72
+ : {}),
73
+ };
74
+ assertApplicationHost(host, nativeApplicationOptions);
75
+ const application = await mountAsync(code, host, nativeApplicationOptions);
76
+ if (fatalErrorHandler === undefined)
77
+ return application;
78
+ let disposal;
79
+ return {
80
+ root: application.root,
81
+ dispose() {
82
+ disposal ??= application
83
+ .dispose()
84
+ .finally(() => fatalErrorHandler.remove());
85
+ return disposal;
86
+ },
87
+ };
88
+ }
89
+ catch (error) {
90
+ fatalErrorHandler?.remove();
91
+ throw error;
92
+ }
93
+ }
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAIrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,EACL,UAAU,GAGX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,mCAAmC,EACnC,sBAAsB,EACtB,oBAAoB,EACpB,iCAAiC,EACjC,oBAAoB,GAIrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,GAMZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAgB7B,MAAM,wBAAwB,CAAC;AAoBhC,wFAAwF;AACxF,MAAM,UAAU,yBAAyB,CACvC,OAA4B,EAC5B,IAAU,EACV,KAAa;IAEb,M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AO;gBACL,QAAQ,KAAK,WAAW;qBACrB,OAAO,EAAE;qBACT,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC7C,OAAO,QAAQ,CAAC;YAClB,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAiB,EAAE,MAAM,EAAE,CAAC;QAC5B,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type CausalTimeline, type SolidDiagnosticsDebugEnvelope, type TreeDebugSnapshot } from "@solidnative-dev/observability";
2
+ export declare const NATIVE_DEBUG_OPERATION_CAUSAL_SNAPSHOT: "causal-snapshot";
3
+ export declare const NATIVE_DEBUG_OPERATION_SOLID_DIAGNOSTICS_BEGIN: "solid-diagnostics-begin";
4
+ export declare const NATIVE_DEBUG_OPERATION_SOLID_DIAGNOSTICS_END: "solid-diagnostics-end";
5
+ export declare const NATIVE_DEBUG_OPERATION_TREE_SNAPSHOT: "tree-snapshot";
6
+ export type ReactNativeDebugOperation = typeof NATIVE_DEBUG_OPERATION_CAUSAL_SNAPSHOT | typeof NATIVE_DEBUG_OPERATION_SOLID_DIAGNOSTICS_BEGIN | typeof NATIVE_DEBUG_OPERATION_SOLID_DIAGNOSTICS_END | typeof NATIVE_DEBUG_OPERATION_TREE_SNAPSHOT;
7
+ export interface ReactNativeSolidDiagnosticsDebugController {
8
+ readonly available: boolean;
9
+ readonly active: boolean;
10
+ begin(): void;
11
+ end(): SolidDiagnosticsDebugEnvelope;
12
+ dispose(): void;
13
+ }
14
+ export interface NativeDebugRequestHandlerOptions {
15
+ readonly reportError?: (error: unknown) => void;
16
+ readonly solidDiagnostics?: ReactNativeSolidDiagnosticsDebugController;
17
+ readonly snapshotTree?: () => TreeDebugSnapshot | undefined;
18
+ }
19
+ export declare function reportNativeDebugError(reporter: ((error: unknown) => void) | undefined, error: unknown): void;
20
+ /** Pure request dispatcher shared by the React Native transport and tests. */
21
+ export declare function createNativeDebugRequestHandler(timeline: CausalTimeline, options: NativeDebugRequestHandlerOptions, publish: (requestId: string, payload: string) => Promise<unknown>): (event: unknown) => void;
22
+ //# sourceMappingURL=native-debug-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-debug-handler.d.ts","sourceRoot":"","sources":["../src/native-debug-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAExC,eAAO,MAAM,sCAAsC,EACjD,iBAA0B,CAAC;AAC7B,eAAO,MAAM,8CAA8C,EACzD,yBAAkC,CAAC;AACrC,eAAO,MAAM,4CAA4C,EACvD,uBAAgC,CAAC;AACnC,eAAO,MAAM,oCAAoC,EAAG,eAAwB,CAAC;AAE7E,MAAM,MAAM,yBAAyB,GACjC,OAAO,sCAAsC,GAC7C,OAAO,8CAA8C,GACrD,OAAO,4CAA4C,GACnD,OAAO,oCAAoC,CAAC;AAEhD,MAAM,WAAW,0CAA0C;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,GAAG,IAAI,6BAA6B,CAAC;IACrC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,0CAA0C,CAAC;IACvE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,iBAAiB,GAAG,SAAS,CAAC;CAC7D;AA2ED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,EAChD,KAAK,EAAE,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