@ghia/native 0.0.0 → 0.11.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 (211) hide show
  1. package/LICENSE +201 -0
  2. package/browser.mjs +7 -0
  3. package/dist/aria.d.ts +72 -0
  4. package/dist/aria.d.ts.map +1 -0
  5. package/dist/aria.js +2 -0
  6. package/dist/aria.js.map +1 -0
  7. package/dist/automation/client.d.ts +243 -0
  8. package/dist/automation/client.d.ts.map +1 -0
  9. package/dist/automation/client.js +801 -0
  10. package/dist/automation/client.js.map +1 -0
  11. package/dist/automation/index.d.ts +5 -0
  12. package/dist/automation/index.d.ts.map +1 -0
  13. package/dist/automation/index.js +4 -0
  14. package/dist/automation/index.js.map +1 -0
  15. package/dist/automation/protocol.d.ts +309 -0
  16. package/dist/automation/protocol.d.ts.map +1 -0
  17. package/dist/automation/protocol.js +320 -0
  18. package/dist/automation/protocol.js.map +1 -0
  19. package/dist/blob-images.d.ts +32 -0
  20. package/dist/blob-images.d.ts.map +1 -0
  21. package/dist/blob-images.js +55 -0
  22. package/dist/blob-images.js.map +1 -0
  23. package/dist/bounds.d.ts +61 -0
  24. package/dist/bounds.d.ts.map +1 -0
  25. package/dist/bounds.js +85 -0
  26. package/dist/bounds.js.map +1 -0
  27. package/dist/clipboard-global.d.ts +11 -0
  28. package/dist/clipboard-global.d.ts.map +1 -0
  29. package/dist/clipboard-global.js +2 -0
  30. package/dist/clipboard-global.js.map +1 -0
  31. package/dist/clipboard.d.ts +19 -0
  32. package/dist/clipboard.d.ts.map +1 -0
  33. package/dist/clipboard.js +41 -0
  34. package/dist/clipboard.js.map +1 -0
  35. package/dist/cpu-throttle.d.ts +6 -0
  36. package/dist/cpu-throttle.d.ts.map +1 -0
  37. package/dist/cpu-throttle.js +42 -0
  38. package/dist/cpu-throttle.js.map +1 -0
  39. package/dist/events/data-transfer.d.ts +23 -0
  40. package/dist/events/data-transfer.d.ts.map +1 -0
  41. package/dist/events/data-transfer.js +97 -0
  42. package/dist/events/data-transfer.js.map +1 -0
  43. package/dist/events/dispatch.d.ts +144 -0
  44. package/dist/events/dispatch.d.ts.map +1 -0
  45. package/dist/events/dispatch.js +241 -0
  46. package/dist/events/dispatch.js.map +1 -0
  47. package/dist/events/drag.d.ts +21 -0
  48. package/dist/events/drag.d.ts.map +1 -0
  49. package/dist/events/drag.js +111 -0
  50. package/dist/events/drag.js.map +1 -0
  51. package/dist/events/event-props.d.ts +19 -0
  52. package/dist/events/event-props.d.ts.map +1 -0
  53. package/dist/events/event-props.js +104 -0
  54. package/dist/events/event-props.js.map +1 -0
  55. package/dist/events/keyboard-defaults.d.ts +18 -0
  56. package/dist/events/keyboard-defaults.d.ts.map +1 -0
  57. package/dist/events/keyboard-defaults.js +121 -0
  58. package/dist/events/keyboard-defaults.js.map +1 -0
  59. package/dist/events/listeners.d.ts +18 -0
  60. package/dist/events/listeners.d.ts.map +1 -0
  61. package/dist/events/listeners.js +49 -0
  62. package/dist/events/listeners.js.map +1 -0
  63. package/dist/events/route.d.ts +17 -0
  64. package/dist/events/route.d.ts.map +1 -0
  65. package/dist/events/route.js +36 -0
  66. package/dist/events/route.js.map +1 -0
  67. package/dist/events/types.d.ts +269 -0
  68. package/dist/events/types.d.ts.map +1 -0
  69. package/dist/events/types.js +2 -0
  70. package/dist/events/types.js.map +1 -0
  71. package/dist/events/window-target.d.ts +120 -0
  72. package/dist/events/window-target.d.ts.map +1 -0
  73. package/dist/events/window-target.js +311 -0
  74. package/dist/events/window-target.js.map +1 -0
  75. package/dist/eyedropper.d.ts +33 -0
  76. package/dist/eyedropper.d.ts.map +1 -0
  77. package/dist/eyedropper.js +66 -0
  78. package/dist/eyedropper.js.map +1 -0
  79. package/dist/focus.d.ts +18 -0
  80. package/dist/focus.d.ts.map +1 -0
  81. package/dist/focus.js +26 -0
  82. package/dist/focus.js.map +1 -0
  83. package/dist/fonts.d.ts +12 -0
  84. package/dist/fonts.d.ts.map +1 -0
  85. package/dist/fonts.js +17 -0
  86. package/dist/fonts.js.map +1 -0
  87. package/dist/forms.d.ts +10 -0
  88. package/dist/forms.d.ts.map +1 -0
  89. package/dist/forms.js +9 -0
  90. package/dist/forms.js.map +1 -0
  91. package/dist/host-runtime.d.ts +108 -0
  92. package/dist/host-runtime.d.ts.map +1 -0
  93. package/dist/host-runtime.js +213 -0
  94. package/dist/host-runtime.js.map +1 -0
  95. package/dist/host.d.ts +2403 -0
  96. package/dist/host.d.ts.map +1 -0
  97. package/dist/host.js +30 -0
  98. package/dist/host.js.map +1 -0
  99. package/dist/idle-gc.d.ts +36 -0
  100. package/dist/idle-gc.d.ts.map +1 -0
  101. package/dist/idle-gc.js +70 -0
  102. package/dist/idle-gc.js.map +1 -0
  103. package/dist/keyframes.d.ts +108 -0
  104. package/dist/keyframes.d.ts.map +1 -0
  105. package/dist/keyframes.js +107 -0
  106. package/dist/keyframes.js.map +1 -0
  107. package/dist/layout-animation.d.ts +38 -0
  108. package/dist/layout-animation.d.ts.map +1 -0
  109. package/dist/layout-animation.js +41 -0
  110. package/dist/layout-animation.js.map +1 -0
  111. package/dist/match-media.d.ts +62 -0
  112. package/dist/match-media.d.ts.map +1 -0
  113. package/dist/match-media.js +272 -0
  114. package/dist/match-media.js.map +1 -0
  115. package/dist/media-query.d.ts +21 -0
  116. package/dist/media-query.d.ts.map +1 -0
  117. package/dist/media-query.js +599 -0
  118. package/dist/media-query.js.map +1 -0
  119. package/dist/motion-bindings.d.ts +36 -0
  120. package/dist/motion-bindings.d.ts.map +1 -0
  121. package/dist/motion-bindings.js +107 -0
  122. package/dist/motion-bindings.js.map +1 -0
  123. package/dist/motion-config.d.ts +20 -0
  124. package/dist/motion-config.d.ts.map +1 -0
  125. package/dist/motion-config.js +51 -0
  126. package/dist/motion-config.js.map +1 -0
  127. package/dist/motion-span.d.ts +57 -0
  128. package/dist/motion-span.d.ts.map +1 -0
  129. package/dist/motion-span.js +150 -0
  130. package/dist/motion-span.js.map +1 -0
  131. package/dist/motion-value.d.ts +269 -0
  132. package/dist/motion-value.d.ts.map +1 -0
  133. package/dist/motion-value.js +941 -0
  134. package/dist/motion-value.js.map +1 -0
  135. package/dist/motion-variants.d.ts +190 -0
  136. package/dist/motion-variants.d.ts.map +1 -0
  137. package/dist/motion-variants.js +249 -0
  138. package/dist/motion-variants.js.map +1 -0
  139. package/dist/mutations.d.ts +65 -0
  140. package/dist/mutations.d.ts.map +1 -0
  141. package/dist/mutations.js +320 -0
  142. package/dist/mutations.js.map +1 -0
  143. package/dist/nativeview.d.ts +10 -0
  144. package/dist/nativeview.d.ts.map +1 -0
  145. package/dist/nativeview.js +92 -0
  146. package/dist/nativeview.js.map +1 -0
  147. package/dist/observers.d.ts +92 -0
  148. package/dist/observers.d.ts.map +1 -0
  149. package/dist/observers.js +579 -0
  150. package/dist/observers.js.map +1 -0
  151. package/dist/presence.d.ts +63 -0
  152. package/dist/presence.d.ts.map +1 -0
  153. package/dist/presence.js +54 -0
  154. package/dist/presence.js.map +1 -0
  155. package/dist/renderer-state.d.ts +155 -0
  156. package/dist/renderer-state.d.ts.map +1 -0
  157. package/dist/renderer-state.js +302 -0
  158. package/dist/renderer-state.js.map +1 -0
  159. package/dist/reorder.d.ts +63 -0
  160. package/dist/reorder.d.ts.map +1 -0
  161. package/dist/reorder.js +303 -0
  162. package/dist/reorder.js.map +1 -0
  163. package/dist/runtime.d.ts +23 -0
  164. package/dist/runtime.d.ts.map +1 -0
  165. package/dist/runtime.js +157 -0
  166. package/dist/runtime.js.map +1 -0
  167. package/dist/screen.d.ts +8 -0
  168. package/dist/screen.d.ts.map +1 -0
  169. package/dist/screen.js +16 -0
  170. package/dist/screen.js.map +1 -0
  171. package/dist/scroll.d.ts +79 -0
  172. package/dist/scroll.d.ts.map +1 -0
  173. package/dist/scroll.js +170 -0
  174. package/dist/scroll.js.map +1 -0
  175. package/dist/style-images.d.ts +20 -0
  176. package/dist/style-images.d.ts.map +1 -0
  177. package/dist/style-images.js +57 -0
  178. package/dist/style-images.js.map +1 -0
  179. package/dist/svg.d.ts +16 -0
  180. package/dist/svg.d.ts.map +1 -0
  181. package/dist/svg.js +119 -0
  182. package/dist/svg.js.map +1 -0
  183. package/dist/testing.d.ts +811 -0
  184. package/dist/testing.d.ts.map +1 -0
  185. package/dist/testing.js +1187 -0
  186. package/dist/testing.js.map +1 -0
  187. package/dist/text-match.d.ts +8 -0
  188. package/dist/text-match.d.ts.map +1 -0
  189. package/dist/text-match.js +10 -0
  190. package/dist/text-match.js.map +1 -0
  191. package/dist/text-selection.d.ts +34 -0
  192. package/dist/text-selection.d.ts.map +1 -0
  193. package/dist/text-selection.js +23 -0
  194. package/dist/text-selection.js.map +1 -0
  195. package/dist/universal-style.d.ts +22 -0
  196. package/dist/universal-style.d.ts.map +1 -0
  197. package/dist/universal-style.js +58 -0
  198. package/dist/universal-style.js.map +1 -0
  199. package/dist/web-animations.d.ts +300 -0
  200. package/dist/web-animations.d.ts.map +1 -0
  201. package/dist/web-animations.js +1032 -0
  202. package/dist/web-animations.js.map +1 -0
  203. package/dist/webview.d.ts +39 -0
  204. package/dist/webview.d.ts.map +1 -0
  205. package/dist/webview.js +26 -0
  206. package/dist/webview.js.map +1 -0
  207. package/gpuix-native.darwin-arm64.node +4 -0
  208. package/index.cjs +789 -0
  209. package/index.d.ts +2603 -0
  210. package/index.js +729 -0
  211. package/package.json +96 -4
package/index.js ADDED
@@ -0,0 +1,729 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /* auto-generated by NAPI-RS */
4
+
5
+ import { createRequire } from 'module'
6
+ const require = createRequire(import.meta.url)
7
+
8
+ const { readFileSync } = require('fs')
9
+ let nativeBinding = null
10
+ // Which artifact actually loaded. The WASI fallback chain overwrites it with
11
+ // the flavor it resolved; the late native retry below leaves it alone because
12
+ // it only runs while no WASI candidate has been loaded.
13
+ let __napiLoadedBindingTarget = 'native'
14
+ const loadErrors = []
15
+
16
+ const isMusl = () => {
17
+ let musl = false
18
+ if (process.platform === 'linux') {
19
+ musl = isMuslFromFilesystem()
20
+ if (musl === null) {
21
+ musl = isMuslFromReport()
22
+ }
23
+ if (musl === null) {
24
+ musl = isMuslFromChildProcess()
25
+ }
26
+ }
27
+ return musl
28
+ }
29
+
30
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
31
+
32
+ const isMuslFromFilesystem = () => {
33
+ try {
34
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
35
+ } catch {
36
+ return null
37
+ }
38
+ }
39
+
40
+ const isMuslFromReport = () => {
41
+ let report = null
42
+ if (process.report && typeof process.report.getReport === 'function') {
43
+ process.report.excludeNetwork = true
44
+ report = process.report.getReport()
45
+ }
46
+ if (!report) {
47
+ return null
48
+ }
49
+ if (report.header && report.header.glibcVersionRuntime) {
50
+ return false
51
+ }
52
+ if (Array.isArray(report.sharedObjects)) {
53
+ if (report.sharedObjects.some(isFileMusl)) {
54
+ return true
55
+ }
56
+ }
57
+ return false
58
+ }
59
+
60
+ const isMuslFromChildProcess = () => {
61
+ try {
62
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
63
+ } catch (e) {
64
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
65
+ return false
66
+ }
67
+ }
68
+
69
+ function requireNative() {
70
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
71
+ try {
72
+ const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
73
+ // The override may be a generated WASI loader, which already reports its
74
+ // own flavor. Adopt it: `module.exports` aliases this object, so claiming
75
+ // 'native' would both misreport the artifact and overwrite the loader's
76
+ // marker through the alias.
77
+ __napiLoadedBindingTarget =
78
+ overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
79
+ ? overrideBinding.__napiBindingTarget
80
+ : 'native'
81
+ return overrideBinding
82
+ } catch (err) {
83
+ loadErrors.push(err)
84
+ }
85
+ } else if (process.platform === 'android') {
86
+ if (process.arch === 'arm64') {
87
+ try {
88
+ return require('./gpuix-native.android-arm64.node')
89
+ } catch (e) {
90
+ loadErrors.push(e)
91
+ }
92
+ try {
93
+ const binding = require('@ghia/native-android-arm64')
94
+ const bindingPackageVersion = require('@ghia/native-android-arm64/package.json').version
95
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
96
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
+ }
98
+ return binding
99
+ } catch (e) {
100
+ loadErrors.push(e)
101
+ }
102
+ } else if (process.arch === 'arm') {
103
+ try {
104
+ return require('./gpuix-native.android-arm-eabi.node')
105
+ } catch (e) {
106
+ loadErrors.push(e)
107
+ }
108
+ try {
109
+ const binding = require('@ghia/native-android-arm-eabi')
110
+ const bindingPackageVersion = require('@ghia/native-android-arm-eabi/package.json').version
111
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
112
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
113
+ }
114
+ return binding
115
+ } catch (e) {
116
+ loadErrors.push(e)
117
+ }
118
+ } else {
119
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
120
+ }
121
+ } else if (process.platform === 'win32') {
122
+ if (process.arch === 'x64') {
123
+ if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
124
+ try {
125
+ return require('./gpuix-native.win32-x64-gnu.node')
126
+ } catch (e) {
127
+ loadErrors.push(e)
128
+ }
129
+ try {
130
+ const binding = require('@ghia/native-win32-x64-gnu')
131
+ const bindingPackageVersion = require('@ghia/native-win32-x64-gnu/package.json').version
132
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
133
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ }
135
+ return binding
136
+ } catch (e) {
137
+ loadErrors.push(e)
138
+ }
139
+ } else {
140
+ try {
141
+ return require('./gpuix-native.win32-x64-msvc.node')
142
+ } catch (e) {
143
+ loadErrors.push(e)
144
+ }
145
+ try {
146
+ const binding = require('@ghia/native-win32-x64-msvc')
147
+ const bindingPackageVersion = require('@ghia/native-win32-x64-msvc/package.json').version
148
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
149
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ }
151
+ return binding
152
+ } catch (e) {
153
+ loadErrors.push(e)
154
+ }
155
+ }
156
+ } else if (process.arch === 'ia32') {
157
+ try {
158
+ return require('./gpuix-native.win32-ia32-msvc.node')
159
+ } catch (e) {
160
+ loadErrors.push(e)
161
+ }
162
+ try {
163
+ const binding = require('@ghia/native-win32-ia32-msvc')
164
+ const bindingPackageVersion = require('@ghia/native-win32-ia32-msvc/package.json').version
165
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
166
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ }
168
+ return binding
169
+ } catch (e) {
170
+ loadErrors.push(e)
171
+ }
172
+ } else if (process.arch === 'arm64') {
173
+ try {
174
+ return require('./gpuix-native.win32-arm64-msvc.node')
175
+ } catch (e) {
176
+ loadErrors.push(e)
177
+ }
178
+ try {
179
+ const binding = require('@ghia/native-win32-arm64-msvc')
180
+ const bindingPackageVersion = require('@ghia/native-win32-arm64-msvc/package.json').version
181
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ }
184
+ return binding
185
+ } catch (e) {
186
+ loadErrors.push(e)
187
+ }
188
+ } else {
189
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
190
+ }
191
+ } else if (process.platform === 'darwin') {
192
+ try {
193
+ return require('./gpuix-native.darwin-universal.node')
194
+ } catch (e) {
195
+ loadErrors.push(e)
196
+ }
197
+ try {
198
+ const binding = require('@ghia/native-darwin-universal')
199
+ const bindingPackageVersion = require('@ghia/native-darwin-universal/package.json').version
200
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
201
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ }
203
+ return binding
204
+ } catch (e) {
205
+ loadErrors.push(e)
206
+ }
207
+ if (process.arch === 'x64') {
208
+ try {
209
+ return require('./gpuix-native.darwin-x64.node')
210
+ } catch (e) {
211
+ loadErrors.push(e)
212
+ }
213
+ try {
214
+ const binding = require('@ghia/native-darwin-x64')
215
+ const bindingPackageVersion = require('@ghia/native-darwin-x64/package.json').version
216
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
217
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
+ }
219
+ return binding
220
+ } catch (e) {
221
+ loadErrors.push(e)
222
+ }
223
+ } else if (process.arch === 'arm64') {
224
+ try {
225
+ return require('./gpuix-native.darwin-arm64.node')
226
+ } catch (e) {
227
+ loadErrors.push(e)
228
+ }
229
+ try {
230
+ const binding = require('@ghia/native-darwin-arm64')
231
+ const bindingPackageVersion = require('@ghia/native-darwin-arm64/package.json').version
232
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
233
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
+ }
235
+ return binding
236
+ } catch (e) {
237
+ loadErrors.push(e)
238
+ }
239
+ } else {
240
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
241
+ }
242
+ } else if (process.platform === 'freebsd') {
243
+ if (process.arch === 'x64') {
244
+ try {
245
+ return require('./gpuix-native.freebsd-x64.node')
246
+ } catch (e) {
247
+ loadErrors.push(e)
248
+ }
249
+ try {
250
+ const binding = require('@ghia/native-freebsd-x64')
251
+ const bindingPackageVersion = require('@ghia/native-freebsd-x64/package.json').version
252
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
253
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
+ }
255
+ return binding
256
+ } catch (e) {
257
+ loadErrors.push(e)
258
+ }
259
+ } else if (process.arch === 'arm64') {
260
+ try {
261
+ return require('./gpuix-native.freebsd-arm64.node')
262
+ } catch (e) {
263
+ loadErrors.push(e)
264
+ }
265
+ try {
266
+ const binding = require('@ghia/native-freebsd-arm64')
267
+ const bindingPackageVersion = require('@ghia/native-freebsd-arm64/package.json').version
268
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
269
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
270
+ }
271
+ return binding
272
+ } catch (e) {
273
+ loadErrors.push(e)
274
+ }
275
+ } else {
276
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
277
+ }
278
+ } else if (process.platform === 'linux') {
279
+ if (process.arch === 'x64') {
280
+ if (isMusl()) {
281
+ try {
282
+ return require('./gpuix-native.linux-x64-musl.node')
283
+ } catch (e) {
284
+ loadErrors.push(e)
285
+ }
286
+ try {
287
+ const binding = require('@ghia/native-linux-x64-musl')
288
+ const bindingPackageVersion = require('@ghia/native-linux-x64-musl/package.json').version
289
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
290
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
291
+ }
292
+ return binding
293
+ } catch (e) {
294
+ loadErrors.push(e)
295
+ }
296
+ } else {
297
+ try {
298
+ return require('./gpuix-native.linux-x64-gnu.node')
299
+ } catch (e) {
300
+ loadErrors.push(e)
301
+ }
302
+ try {
303
+ const binding = require('@ghia/native-linux-x64-gnu')
304
+ const bindingPackageVersion = require('@ghia/native-linux-x64-gnu/package.json').version
305
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
306
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
307
+ }
308
+ return binding
309
+ } catch (e) {
310
+ loadErrors.push(e)
311
+ }
312
+ }
313
+ } else if (process.arch === 'arm64') {
314
+ if (isMusl()) {
315
+ try {
316
+ return require('./gpuix-native.linux-arm64-musl.node')
317
+ } catch (e) {
318
+ loadErrors.push(e)
319
+ }
320
+ try {
321
+ const binding = require('@ghia/native-linux-arm64-musl')
322
+ const bindingPackageVersion = require('@ghia/native-linux-arm64-musl/package.json').version
323
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
325
+ }
326
+ return binding
327
+ } catch (e) {
328
+ loadErrors.push(e)
329
+ }
330
+ } else {
331
+ try {
332
+ return require('./gpuix-native.linux-arm64-gnu.node')
333
+ } catch (e) {
334
+ loadErrors.push(e)
335
+ }
336
+ try {
337
+ const binding = require('@ghia/native-linux-arm64-gnu')
338
+ const bindingPackageVersion = require('@ghia/native-linux-arm64-gnu/package.json').version
339
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
340
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
+ }
342
+ return binding
343
+ } catch (e) {
344
+ loadErrors.push(e)
345
+ }
346
+ }
347
+ } else if (process.arch === 'arm') {
348
+ if (isMusl()) {
349
+ try {
350
+ return require('./gpuix-native.linux-arm-musleabihf.node')
351
+ } catch (e) {
352
+ loadErrors.push(e)
353
+ }
354
+ try {
355
+ const binding = require('@ghia/native-linux-arm-musleabihf')
356
+ const bindingPackageVersion = require('@ghia/native-linux-arm-musleabihf/package.json').version
357
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
359
+ }
360
+ return binding
361
+ } catch (e) {
362
+ loadErrors.push(e)
363
+ }
364
+ } else {
365
+ try {
366
+ return require('./gpuix-native.linux-arm-gnueabihf.node')
367
+ } catch (e) {
368
+ loadErrors.push(e)
369
+ }
370
+ try {
371
+ const binding = require('@ghia/native-linux-arm-gnueabihf')
372
+ const bindingPackageVersion = require('@ghia/native-linux-arm-gnueabihf/package.json').version
373
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
374
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
+ }
376
+ return binding
377
+ } catch (e) {
378
+ loadErrors.push(e)
379
+ }
380
+ }
381
+ } else if (process.arch === 'loong64') {
382
+ if (isMusl()) {
383
+ try {
384
+ return require('./gpuix-native.linux-loong64-musl.node')
385
+ } catch (e) {
386
+ loadErrors.push(e)
387
+ }
388
+ try {
389
+ const binding = require('@ghia/native-linux-loong64-musl')
390
+ const bindingPackageVersion = require('@ghia/native-linux-loong64-musl/package.json').version
391
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
393
+ }
394
+ return binding
395
+ } catch (e) {
396
+ loadErrors.push(e)
397
+ }
398
+ } else {
399
+ try {
400
+ return require('./gpuix-native.linux-loong64-gnu.node')
401
+ } catch (e) {
402
+ loadErrors.push(e)
403
+ }
404
+ try {
405
+ const binding = require('@ghia/native-linux-loong64-gnu')
406
+ const bindingPackageVersion = require('@ghia/native-linux-loong64-gnu/package.json').version
407
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
408
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
+ }
410
+ return binding
411
+ } catch (e) {
412
+ loadErrors.push(e)
413
+ }
414
+ }
415
+ } else if (process.arch === 'riscv64') {
416
+ if (isMusl()) {
417
+ try {
418
+ return require('./gpuix-native.linux-riscv64-musl.node')
419
+ } catch (e) {
420
+ loadErrors.push(e)
421
+ }
422
+ try {
423
+ const binding = require('@ghia/native-linux-riscv64-musl')
424
+ const bindingPackageVersion = require('@ghia/native-linux-riscv64-musl/package.json').version
425
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
+ }
428
+ return binding
429
+ } catch (e) {
430
+ loadErrors.push(e)
431
+ }
432
+ } else {
433
+ try {
434
+ return require('./gpuix-native.linux-riscv64-gnu.node')
435
+ } catch (e) {
436
+ loadErrors.push(e)
437
+ }
438
+ try {
439
+ const binding = require('@ghia/native-linux-riscv64-gnu')
440
+ const bindingPackageVersion = require('@ghia/native-linux-riscv64-gnu/package.json').version
441
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
442
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ }
444
+ return binding
445
+ } catch (e) {
446
+ loadErrors.push(e)
447
+ }
448
+ }
449
+ } else if (process.arch === 'ppc64') {
450
+ try {
451
+ return require('./gpuix-native.linux-ppc64-gnu.node')
452
+ } catch (e) {
453
+ loadErrors.push(e)
454
+ }
455
+ try {
456
+ const binding = require('@ghia/native-linux-ppc64-gnu')
457
+ const bindingPackageVersion = require('@ghia/native-linux-ppc64-gnu/package.json').version
458
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
459
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
460
+ }
461
+ return binding
462
+ } catch (e) {
463
+ loadErrors.push(e)
464
+ }
465
+ } else if (process.arch === 's390x') {
466
+ try {
467
+ return require('./gpuix-native.linux-s390x-gnu.node')
468
+ } catch (e) {
469
+ loadErrors.push(e)
470
+ }
471
+ try {
472
+ const binding = require('@ghia/native-linux-s390x-gnu')
473
+ const bindingPackageVersion = require('@ghia/native-linux-s390x-gnu/package.json').version
474
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
475
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
476
+ }
477
+ return binding
478
+ } catch (e) {
479
+ loadErrors.push(e)
480
+ }
481
+ } else {
482
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
483
+ }
484
+ } else if (process.platform === 'openharmony') {
485
+ if (process.arch === 'arm64') {
486
+ try {
487
+ return require('./gpuix-native.openharmony-arm64.node')
488
+ } catch (e) {
489
+ loadErrors.push(e)
490
+ }
491
+ try {
492
+ const binding = require('@ghia/native-openharmony-arm64')
493
+ const bindingPackageVersion = require('@ghia/native-openharmony-arm64/package.json').version
494
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
495
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
496
+ }
497
+ return binding
498
+ } catch (e) {
499
+ loadErrors.push(e)
500
+ }
501
+ } else if (process.arch === 'x64') {
502
+ try {
503
+ return require('./gpuix-native.openharmony-x64.node')
504
+ } catch (e) {
505
+ loadErrors.push(e)
506
+ }
507
+ try {
508
+ const binding = require('@ghia/native-openharmony-x64')
509
+ const bindingPackageVersion = require('@ghia/native-openharmony-x64/package.json').version
510
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
511
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
+ }
513
+ return binding
514
+ } catch (e) {
515
+ loadErrors.push(e)
516
+ }
517
+ } else if (process.arch === 'arm') {
518
+ try {
519
+ return require('./gpuix-native.openharmony-arm.node')
520
+ } catch (e) {
521
+ loadErrors.push(e)
522
+ }
523
+ try {
524
+ const binding = require('@ghia/native-openharmony-arm')
525
+ const bindingPackageVersion = require('@ghia/native-openharmony-arm/package.json').version
526
+ if (bindingPackageVersion !== '0.11.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
527
+ throw new Error(`Native binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
528
+ }
529
+ return binding
530
+ } catch (e) {
531
+ loadErrors.push(e)
532
+ }
533
+ } else {
534
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
535
+ }
536
+ } else {
537
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
538
+ }
539
+ }
540
+
541
+ function createLoadErrorChain(errors) {
542
+ return errors.reduce((previous, current) => {
543
+ let message
544
+ try {
545
+ message =
546
+ current && typeof current.message === 'string'
547
+ ? current.message
548
+ : String(current)
549
+ } catch {
550
+ message = 'Unknown error'
551
+ }
552
+ const error = new Error(message)
553
+ error.cause = previous
554
+ return error
555
+ }, null)
556
+ }
557
+
558
+ // NAPI_RS_FORCE_WASI is a tri-state flag:
559
+ // unset / any other value → native binding preferred, WASI is only a fallback
560
+ // 'true' → prefer WASI, but retain native as a lazy fallback
561
+ // 'error' → require WASI without initializing a native fallback
562
+ // Treating any non-empty string as truthy (the historical behavior) meant
563
+ // NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
564
+ // the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
565
+ //
566
+ // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
567
+ // WASI loading. It never crosses into another flavor or falls back to native.
568
+ const __napiWasiFlavors = ['wasm32-wasi']
569
+ const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
570
+ const __napiWasiFlavorRequested =
571
+ typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
572
+ if (
573
+ __napiWasiFlavorRequested &&
574
+ __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1
575
+ ) {
576
+ throw new Error(
577
+ 'Unsupported WASI flavor "' +
578
+ __napiWasiFlavor +
579
+ '". Available flavors: ' +
580
+ __napiWasiFlavors.join(', '),
581
+ )
582
+ }
583
+ const forceWasiError = process.env.NAPI_RS_FORCE_WASI === 'error'
584
+ const forceWasi =
585
+ process.env.NAPI_RS_FORCE_WASI === 'true' ||
586
+ forceWasiError ||
587
+ __napiWasiFlavorRequested
588
+
589
+ if (!forceWasi) {
590
+ nativeBinding = requireNative()
591
+ }
592
+
593
+ if (!nativeBinding || forceWasi) {
594
+ let wasiBinding = null
595
+ let wasiBindingLoaded = false
596
+ const wasiBindingErrors = []
597
+ const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
598
+ try {
599
+ require.resolve(specifier)
600
+ } catch (resolveError) {
601
+ if (!resolveError || resolveError.code !== 'MODULE_NOT_FOUND') {
602
+ throw resolveError
603
+ }
604
+ if (isPackage) {
605
+ try {
606
+ require.resolve(specifier + '/package.json')
607
+ } catch (packageError) {
608
+ if (packageError && packageError.code === 'MODULE_NOT_FOUND') {
609
+ return resolveError
610
+ }
611
+ // An exports restriction proves the package exists even when its
612
+ // package.json is not public. Preserve the root resolution failure.
613
+ throw resolveError
614
+ }
615
+ // The package exists but its main/export target is broken.
616
+ throw resolveError
617
+ }
618
+ return resolveError
619
+ }
620
+ if (localArtifacts) {
621
+ let artifactError = null
622
+ for (let i = 0; i < localArtifacts.length; i++) {
623
+ try {
624
+ require.resolve(localArtifacts[i])
625
+ return null
626
+ } catch (resolveError) {
627
+ if (!resolveError || resolveError.code !== 'MODULE_NOT_FOUND') {
628
+ throw resolveError
629
+ }
630
+ artifactError = resolveError
631
+ }
632
+ }
633
+ return artifactError
634
+ }
635
+ return null
636
+ }
637
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
638
+ let candidateError = null
639
+ let candidateFailed = false
640
+ try {
641
+ candidateError = __napiWasiResolveCandidate('./gpuix-native.wasi.cjs', false, ['./gpuix-native.wasm32-wasi.debug.wasm', './gpuix-native.wasm32-wasi.wasm'])
642
+ candidateFailed = candidateError !== null
643
+ if (!candidateFailed) {
644
+ wasiBinding = require('./gpuix-native.wasi.cjs')
645
+ nativeBinding = wasiBinding
646
+ __napiLoadedBindingTarget = 'wasm32-wasi'
647
+ wasiBindingLoaded = true
648
+ }
649
+ } catch (err) {
650
+ candidateError = err
651
+ candidateFailed = true
652
+ }
653
+ if (candidateFailed) {
654
+ wasiBindingErrors.push(candidateError)
655
+ loadErrors.push(candidateError)
656
+ }
657
+ }
658
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
659
+ let candidateError = null
660
+ let candidateFailed = false
661
+ try {
662
+ candidateError = __napiWasiResolveCandidate('@ghia/native-wasm32-wasi', true, undefined)
663
+ candidateFailed = candidateError !== null
664
+ if (!candidateFailed) {
665
+ if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
666
+ const bindingPackageVersion = require('@ghia/native-wasm32-wasi/package.json').version
667
+ if (bindingPackageVersion !== '0.11.0') {
668
+ throw new Error(`WASI binding package version mismatch, expected 0.11.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
669
+ }
670
+ }
671
+ wasiBinding = require('@ghia/native-wasm32-wasi')
672
+ nativeBinding = wasiBinding
673
+ __napiLoadedBindingTarget = 'wasm32-wasi'
674
+ wasiBindingLoaded = true
675
+ }
676
+ } catch (err) {
677
+ candidateError = err
678
+ candidateFailed = true
679
+ }
680
+ if (candidateFailed) {
681
+ wasiBindingErrors.push(candidateError)
682
+ loadErrors.push(candidateError)
683
+ }
684
+ }
685
+ if (
686
+ !wasiBindingLoaded &&
687
+ forceWasi &&
688
+ !forceWasiError &&
689
+ !__napiWasiFlavorRequested
690
+ ) {
691
+ nativeBinding = requireNative()
692
+ }
693
+ if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
694
+ const error = new Error(
695
+ __napiWasiFlavorRequested
696
+ ? 'WASI binding for flavor "' + __napiWasiFlavor + '" not found'
697
+ : 'WASI binding not found and NAPI_RS_FORCE_WASI is set to error',
698
+ )
699
+ error.cause = createLoadErrorChain(wasiBindingErrors)
700
+ throw error
701
+ }
702
+ }
703
+
704
+ if (!nativeBinding) {
705
+ if (loadErrors.length > 0) {
706
+ const error = new Error(
707
+ `Cannot find native binding. ` +
708
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
709
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
710
+ )
711
+ // assign instead of the `new Error(message, { cause })` options form,
712
+ // which Node < 16.9 silently ignores
713
+ error.cause = createLoadErrorChain(loadErrors)
714
+ throw error
715
+ }
716
+ throw new Error(`Failed to load native binding`)
717
+ }
718
+
719
+ const { AvailableUpdate, GpuixRenderer, TestGpuixRenderer, checkUpdate, getAllDisplays, getPrimaryDisplay, hasTestGpuixRenderer, measureMotionAnimation, validateKeyframes } = nativeBinding
720
+ export { AvailableUpdate }
721
+ export { GpuixRenderer }
722
+ export { TestGpuixRenderer }
723
+ export { checkUpdate }
724
+ export { getAllDisplays }
725
+ export { getPrimaryDisplay }
726
+ export { hasTestGpuixRenderer }
727
+ export { measureMotionAnimation }
728
+ export { validateKeyframes }
729
+ export const __napiBindingTarget = __napiLoadedBindingTarget