@opentui/solid 0.1.107 → 0.2.1

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
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
7
- "version": "0.1.107",
7
+ "version": "0.2.1",
8
8
  "description": "SolidJS renderer for OpenTUI",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@babel/core": "7.28.0",
37
37
  "@babel/preset-typescript": "7.27.1",
38
- "@opentui/core": "0.1.107",
38
+ "@opentui/core": "0.2.1",
39
39
  "babel-plugin-module-resolver": "5.0.2",
40
40
  "babel-preset-solid": "1.9.12",
41
41
  "entities": "7.0.1",
@@ -12,12 +12,29 @@ import * as solidRuntime from "../index.js"
12
12
  import { ensureSolidTransformPlugin } from "./solid-plugin.js"
13
13
 
14
14
  const runtimePluginSupportInstalledKey = Symbol.for("opentui.solid.runtime-plugin-support")
15
+ const THREE_RUNTIME_SPECIFIER = "@opentui/three"
15
16
 
16
17
  type RuntimePluginSupportState = typeof globalThis & {
17
18
  [runtimePluginSupportInstalledKey]?: boolean
18
19
  }
19
20
 
21
+ const loadThreeRuntimeModule = async (): Promise<Record<string, unknown>> => {
22
+ try {
23
+ return (await importRuntimeModule(THREE_RUNTIME_SPECIFIER)) as Record<string, unknown>
24
+ } catch (error) {
25
+ const message = error instanceof Error ? error.message : String(error)
26
+ throw new Error(
27
+ `Failed to load @opentui/three runtime module. Install @opentui/three in the host app before loading 3D plugins. ${message}`,
28
+ )
29
+ }
30
+ }
31
+
32
+ function importRuntimeModule(specifier: string): Promise<Record<string, unknown>> {
33
+ return import(specifier) as Promise<Record<string, unknown>>
34
+ }
35
+
20
36
  const additionalRuntimeModules: Record<string, RuntimeModuleEntry> = {
37
+ [THREE_RUNTIME_SPECIFIER]: loadThreeRuntimeModule,
21
38
  "@opentui/solid": solidRuntime as Record<string, unknown>,
22
39
  "solid-js": solidJsRuntime as Record<string, unknown>,
23
40
  "solid-js/store": solidJsStoreRuntime as Record<string, unknown>,