@qvac/sdk 0.21.1 → 0.23.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 (249) hide show
  1. package/NOTICE +131 -62
  2. package/README.md +31 -326
  3. package/dist/examples/abot-world.js +1 -1
  4. package/dist/examples/advisory-model-fit.d.ts +0 -58
  5. package/dist/examples/advisory-model-fit.js +23 -150
  6. package/dist/examples/asr/moss-transcribe-filesystem.d.ts +2 -0
  7. package/dist/examples/asr/moss-transcribe-filesystem.js +84 -0
  8. package/dist/examples/asr/moss-transcribe-fit.d.ts +2 -0
  9. package/dist/examples/asr/moss-transcribe-fit.js +40 -0
  10. package/dist/examples/asr/nemotron-diarization-filesystem.d.ts +2 -0
  11. package/dist/examples/asr/nemotron-diarization-filesystem.js +64 -0
  12. package/dist/examples/asr/parakeet-ctc-filesystem.js +2 -2
  13. package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +2 -2
  14. package/dist/examples/asr/parakeet-microphone-record.js +1 -1
  15. package/dist/examples/asr/parakeet-microphone-stream.js +1 -1
  16. package/dist/examples/asr/parakeet-nemotron-filesystem.js +3 -3
  17. package/dist/examples/asr/parakeet-sortformer-streaming.js +2 -2
  18. package/dist/examples/asr/parakeet-sortformer.js +1 -1
  19. package/dist/examples/asr/parakeet-tdt-filesystem-chunked.js +2 -2
  20. package/dist/examples/asr/parakeet-tdt-filesystem.js +2 -2
  21. package/dist/examples/asr/parakeet-transcribepsy-filesystem.d.ts +2 -0
  22. package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +76 -0
  23. package/dist/examples/asr/parakeet-unified-coreml.js +2 -2
  24. package/dist/examples/asr/parakeet-unified-filesystem.js +2 -2
  25. package/dist/examples/asr/whispercpp-filesystem-streaming.js +1 -1
  26. package/dist/examples/asr/whispercpp-filesystem.js +1 -1
  27. package/dist/examples/asr/whispercpp-microphone-record.js +1 -1
  28. package/dist/examples/asr/whispercpp-prompt.js +1 -1
  29. package/dist/examples/assess-model-fit.js +3 -6
  30. package/dist/examples/audiogen/edit-music.js +2 -2
  31. package/dist/examples/audiogen/generate-cover.js +2 -2
  32. package/dist/examples/audiogen/generate-music-minimax.js +1 -1
  33. package/dist/examples/audiogen/generate-music.js +1 -1
  34. package/dist/examples/audiogen/understand-music.js +2 -2
  35. package/dist/examples/batch-completion.d.ts +1 -1
  36. package/dist/examples/batch-completion.js +1 -1
  37. package/dist/examples/bci/bci-filesystem-streaming.js +2 -2
  38. package/dist/examples/bci/bci-filesystem.js +2 -2
  39. package/dist/examples/concurrent-completion-collision.js +1 -1
  40. package/dist/examples/config-reload.js +1 -1
  41. package/dist/examples/decisions.d.ts +2 -0
  42. package/dist/examples/decisions.js +38 -0
  43. package/dist/examples/diffusion-esrgan-upscale.js +1 -1
  44. package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
  45. package/dist/examples/diffusion-img2img.js +1 -1
  46. package/dist/examples/diffusion-img2vid-ltx.js +8 -15
  47. package/dist/examples/diffusion-img2vid-minimax-h3.d.ts +2 -0
  48. package/dist/examples/diffusion-img2vid-minimax-h3.js +72 -0
  49. package/dist/examples/diffusion-img2vid.js +1 -1
  50. package/dist/examples/diffusion-qwen-image-21.d.ts +2 -0
  51. package/dist/examples/diffusion-qwen-image-21.js +104 -0
  52. package/dist/examples/diffusion-txt2vid-ltx.js +7 -14
  53. package/dist/examples/finetune/llamacpp-finetune.js +9 -4
  54. package/dist/examples/llamacpp-filesystem.js +1 -1
  55. package/dist/examples/llamacpp-multi-gpu.js +2 -2
  56. package/dist/examples/llamacpp-multimodal.js +3 -1
  57. package/dist/examples/llamacpp-structured-output.js +1 -1
  58. package/dist/examples/mcp-websearch.d.ts +2 -2
  59. package/dist/examples/mcp-websearch.js +4 -4
  60. package/dist/examples/model-fit-ui/server.d.ts +1 -1
  61. package/dist/examples/model-fit-ui/server.js +1 -1
  62. package/dist/examples/multi-job-completion.d.ts +1 -1
  63. package/dist/examples/multi-job-completion.js +1 -1
  64. package/dist/examples/ocr-fasttext.js +1 -1
  65. package/dist/examples/plugins.js +1 -1
  66. package/dist/examples/rerank.d.ts +2 -0
  67. package/dist/examples/rerank.js +33 -0
  68. package/dist/examples/tools/llamacpp-deferred-tools.js +5 -5
  69. package/dist/examples/tools/llamacpp-tools-auto-dialect.js +5 -4
  70. package/dist/examples/tools/llamacpp-tools-gemma4.js +4 -4
  71. package/dist/examples/tools/llamacpp-tools-qwen35.js +5 -4
  72. package/dist/examples/tts/llm-to-tts-streaming.d.ts +2 -2
  73. package/dist/examples/tts/llm-to-tts-streaming.js +2 -2
  74. package/dist/examples/tts/moss-sound-effect-controls.d.ts +2 -0
  75. package/dist/examples/tts/moss-sound-effect-controls.js +88 -0
  76. package/dist/examples/tts/moss-sound-effect.d.ts +2 -0
  77. package/dist/examples/tts/moss-sound-effect.js +86 -0
  78. package/dist/examples/tts/moss-speech-audio.d.ts +2 -0
  79. package/dist/examples/tts/moss-speech-audio.js +159 -0
  80. package/dist/examples/tts/moss-speech.d.ts +2 -0
  81. package/dist/examples/tts/moss-speech.js +70 -0
  82. package/dist/examples/vla-groot.js +2 -2
  83. package/dist/examples/vla-pi05.js +2 -2
  84. package/dist/examples/vla-smolvla.js +2 -2
  85. package/dist/examples/voice-assistant/voice-assistant.js +1 -1
  86. package/dist/scripts/contract/build-contract.d.ts +3 -1
  87. package/dist/scripts/contract/build-contract.js +40 -2
  88. package/dist/scripts/contract/build-model-type-maps.d.ts +6 -1
  89. package/dist/scripts/contract/build-model-type-maps.js +3 -2
  90. package/dist/scripts/contract/constants-registry.d.ts +6 -0
  91. package/dist/scripts/contract/constants-registry.js +4 -1
  92. package/dist/scripts/contract/method-shapes.d.ts +2 -0
  93. package/dist/scripts/contract/method-shapes.js +2 -0
  94. package/dist/scripts/export-contract.js +20 -7
  95. package/dist/scripts/run-unit-tests.js +10 -5
  96. package/dist/src/client/api/assess-model-fit.d.ts +5 -5
  97. package/dist/src/client/api/assess-model-fit.js +6 -7
  98. package/dist/src/client/api/audio-edit.d.ts +14 -2
  99. package/dist/src/client/api/audio-edit.js +16 -4
  100. package/dist/src/client/api/audio-gen-result.js +2 -2
  101. package/dist/src/client/api/audio-gen.d.ts +10 -2
  102. package/dist/src/client/api/audio-gen.js +12 -4
  103. package/dist/src/client/api/audio-understand.d.ts +1 -1
  104. package/dist/src/client/api/audio-understand.js +3 -3
  105. package/dist/src/client/api/batch-completion.js +3 -3
  106. package/dist/src/client/api/bci-transcribe.js +3 -3
  107. package/dist/src/client/api/cancel.js +1 -1
  108. package/dist/src/client/api/classify.js +1 -1
  109. package/dist/src/client/api/completion-stream.d.ts +2 -1
  110. package/dist/src/client/api/completion-stream.js +6 -4
  111. package/dist/src/client/api/decide.d.ts +31 -0
  112. package/dist/src/client/api/decide.js +29 -0
  113. package/dist/src/client/api/delete-cache.js +1 -1
  114. package/dist/src/client/api/diffusion.d.ts +18 -1
  115. package/dist/src/client/api/diffusion.js +19 -2
  116. package/dist/src/client/api/download-asset.js +3 -3
  117. package/dist/src/client/api/embed.js +2 -2
  118. package/dist/src/client/api/finetune.js +3 -3
  119. package/dist/src/client/api/get-loaded-model-info.js +1 -1
  120. package/dist/src/client/api/get-model-info.js +1 -1
  121. package/dist/src/client/api/get-system-resources.js +1 -1
  122. package/dist/src/client/api/heartbeat.js +1 -1
  123. package/dist/src/client/api/index.d.ts +5 -3
  124. package/dist/src/client/api/index.js +5 -3
  125. package/dist/src/client/api/invoke-plugin.js +1 -1
  126. package/dist/src/client/api/load-model.d.ts +1 -0
  127. package/dist/src/client/api/load-model.js +4 -4
  128. package/dist/src/client/api/logging-stream.d.ts +11 -2
  129. package/dist/src/client/api/logging-stream.js +12 -3
  130. package/dist/src/client/api/ocr.js +1 -1
  131. package/dist/src/client/api/rag.js +2 -2
  132. package/dist/src/client/api/registry.d.ts +2 -1
  133. package/dist/src/client/api/registry.js +6 -5
  134. package/dist/src/client/api/rerank.d.ts +22 -0
  135. package/dist/src/client/api/rerank.js +39 -0
  136. package/dist/src/client/api/resume.js +1 -1
  137. package/dist/src/client/api/rpc-server.js +2 -2
  138. package/dist/src/client/api/state.js +1 -1
  139. package/dist/src/client/api/subscribe-logs.js +3 -2
  140. package/dist/src/client/api/suspend.js +1 -1
  141. package/dist/src/client/api/text-to-speech.d.ts +1 -0
  142. package/dist/src/client/api/text-to-speech.js +18 -25
  143. package/dist/src/client/api/transcribe.d.ts +1 -1
  144. package/dist/src/client/api/transcribe.js +7 -4
  145. package/dist/src/client/api/translate.js +2 -2
  146. package/dist/src/client/api/unload-model.js +2 -2
  147. package/dist/src/client/api/upscale.js +1 -1
  148. package/dist/src/client/api/vector-index.d.ts +1 -1
  149. package/dist/src/client/api/vector-index.js +1 -1
  150. package/dist/src/client/api/video-request.d.ts +5 -5
  151. package/dist/src/client/api/video.d.ts +23 -3
  152. package/dist/src/client/api/video.js +26 -6
  153. package/dist/src/client/api/world-result.js +2 -2
  154. package/dist/src/client/api/world.d.ts +1 -1
  155. package/dist/src/client/api/world.js +2 -2
  156. package/dist/src/client/logging-stream-registry.js +9 -6
  157. package/dist/src/client/plugins-factory.d.ts +1 -1
  158. package/dist/src/client/plugins-factory.js +1 -1
  159. package/dist/src/client/rpc/expo-rpc-client.js +3 -3
  160. package/dist/src/client/rpc/ipc-socket-path.d.ts +11 -0
  161. package/dist/src/client/rpc/ipc-socket-path.js +30 -0
  162. package/dist/src/client/rpc/node-rpc-client.js +14 -25
  163. package/dist/src/client/rpc/rpc-client.d.ts +3 -2
  164. package/dist/src/client/rpc/rpc-client.js +46 -12
  165. package/dist/src/client/rpc/rpc-error.js +4 -1
  166. package/dist/src/commands/bundle/bare-pack.d.ts +8 -0
  167. package/dist/src/commands/bundle/bare-pack.js +28 -5
  168. package/dist/src/commands/bundle/constants.js +3 -0
  169. package/dist/src/commands/bundle/entry-gen.js +1 -1
  170. package/dist/src/commands/bundle/index.d.ts +8 -7
  171. package/dist/src/commands/bundle/index.js +135 -52
  172. package/dist/src/commands/bundle/manifest.d.ts +2 -0
  173. package/dist/src/commands/bundle/manifest.js +3 -2
  174. package/dist/src/commands/bundle/plugins.js +1 -1
  175. package/dist/src/commands/host-prebuilds/index.d.ts +18 -10
  176. package/dist/src/commands/host-prebuilds/index.js +39 -20
  177. package/dist/src/commands/index.d.ts +13 -13
  178. package/dist/src/commands/index.js +8 -8
  179. package/dist/src/commands/verify/abi.d.ts +1 -1
  180. package/dist/src/commands/verify/abi.js +1 -1
  181. package/dist/src/commands/verify/addon-source.d.ts +12 -0
  182. package/dist/src/commands/verify/addon-source.js +36 -3
  183. package/dist/src/commands/verify/bare-kit-runtime.d.ts +1 -1
  184. package/dist/src/commands/verify/bare-kit-runtime.js +1 -1
  185. package/dist/src/commands/verify/bare-kit-runtimes.js +2 -1
  186. package/dist/src/commands/verify/bundle-source.d.ts +1 -1
  187. package/dist/src/commands/verify/bundle-source.js +3 -3
  188. package/dist/src/commands/verify/engines-advice.d.ts +4 -4
  189. package/dist/src/commands/verify/engines-advice.js +4 -4
  190. package/dist/src/commands/verify/index.d.ts +5 -5
  191. package/dist/src/commands/verify/index.js +7 -7
  192. package/dist/src/commands/verify/node-modules-source.d.ts +1 -1
  193. package/dist/src/commands/verify/node-modules-source.js +11 -2
  194. package/dist/src/{expo/plugins/patches/qvac-platform-addons.d.ts → commands/verify/platform-addons.d.ts} +6 -10
  195. package/dist/src/{expo/plugins/patches/qvac-platform-addons.js → commands/verify/platform-addons.js} +2 -45
  196. package/dist/src/commands/verify/prebuilds.d.ts +8 -11
  197. package/dist/src/commands/verify/prebuilds.js +44 -35
  198. package/dist/src/commands/verify/resource-collectors.js +2 -2
  199. package/dist/src/expo/plugins/link-addons.d.ts +18 -0
  200. package/dist/src/expo/plugins/link-addons.js +65 -0
  201. package/dist/src/expo/plugins/withAndroidNdkVersion.js +16 -10
  202. package/dist/src/expo/plugins/withDeviceInfo.js +19 -5
  203. package/dist/src/expo/plugins/withMobileBundle.d.ts +13 -23
  204. package/dist/src/expo/plugins/withMobileBundle.js +27 -117
  205. package/dist/src/index.d.ts +4 -4
  206. package/dist/src/index.js +3 -3
  207. package/dist/src/logging/addon.d.ts +1 -1
  208. package/dist/src/pear/pre.js +4 -0
  209. package/dist/src/plugin-ids.d.ts +4 -1
  210. package/dist/src/plugin-ids.js +6 -0
  211. package/dist/src/schemas/public.d.ts +2 -1
  212. package/dist/src/schemas/public.js +2 -1
  213. package/dist/src/schemas/sdk-errors-client.d.ts +3 -0
  214. package/dist/src/schemas/sdk-errors-client.js +16 -0
  215. package/dist/src/schemas/sdk-errors-server.d.ts +2 -0
  216. package/dist/src/schemas/sdk-errors-server.js +11 -1
  217. package/dist/src/server/rpc/rpc-utils.d.ts +5 -0
  218. package/dist/src/server/rpc/rpc-utils.js +7 -0
  219. package/dist/src/server/utils/qvac-paths.js +1 -1
  220. package/dist/src/server/utils/worker-lock.js +1 -1
  221. package/dist/src/utils/aggregate-events.d.ts +1 -1
  222. package/dist/src/utils/aggregate-events.js +2 -2
  223. package/dist/src/utils/errors-client.d.ts +10 -0
  224. package/dist/src/utils/errors-client.js +18 -0
  225. package/dist/src/utils/errors-server.d.ts +6 -0
  226. package/dist/src/utils/errors-server.js +12 -0
  227. package/dist/src/utils/mcp-adapter.d.ts +1 -1
  228. package/dist/src/utils/mcp-adapter.js +13 -9
  229. package/dist/src/utils/tool-helpers.d.ts +1 -1
  230. package/dist/src/utils/tool-helpers.js +21 -53
  231. package/dist/src/worker/create-server.d.ts +1 -0
  232. package/dist/src/worker/create-server.js +5 -0
  233. package/dist/src/worker/handle-request.js +4 -2
  234. package/dist/src/worker/handler-utils.js +1 -1
  235. package/dist/src/worker/index.js +7 -1
  236. package/dist/src/worker/lifecycle.js +10 -2
  237. package/dist/src/worker/plugins/llamacpp-decision.d.ts +2 -0
  238. package/dist/src/worker/plugins/llamacpp-decision.js +1 -0
  239. package/dist/src/worker/plugins/llamacpp-rerank.d.ts +2 -0
  240. package/dist/src/worker/plugins/llamacpp-rerank.js +1 -0
  241. package/dist/src/worker/plugins/moss-transcribe.d.ts +2 -0
  242. package/dist/src/worker/plugins/moss-transcribe.js +1 -0
  243. package/package.json +63 -53
  244. package/src/electron-forge/index.cjs +12 -71
  245. package/dist/scripts/link-workspace-inference.d.ts +0 -2
  246. package/dist/scripts/link-workspace-inference.js +0 -31
  247. package/src/expo/plugins/patches/android-link.mjs +0 -67
  248. package/src/expo/plugins/patches/ios-link.mjs +0 -67
  249. package/src/expo/plugins/patches/qvac-platform-addons.ts +0 -124
@@ -1,10 +1,10 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import semver from 'semver';
4
- import { createCommandLogger } from '../command-logger.js';
5
- import { readAddonPackageJson } from '../verify/addon-source.js';
6
- import { checkPrebuilds, isMobileHost } from '../verify/prebuilds.js';
7
- import { checkPackageManagerSupport, detectPackageManager, installArgs, isPackageManagerName, isWorkspaceMember, runPackageManager } from './package-manager.js';
4
+ import { createCommandLogger } from '../../commands/command-logger.js';
5
+ import { readAddonPackageJson } from '../../commands/verify/addon-source.js';
6
+ import { checkPrebuilds, isMobileHost } from '../../commands/verify/prebuilds.js';
7
+ import { checkPackageManagerSupport, detectPackageManager, installArgs, isPackageManagerName, isWorkspaceMember, runPackageManager } from '../../commands/host-prebuilds/package-manager.js';
8
8
  import { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError } from '../../utils/errors-client.js';
9
9
  /** npm's package-name grammar. On Windows the names pass through a shell. */
10
10
  const PACKAGE_NAME = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
@@ -13,15 +13,15 @@ const PACKAGE_NAME = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
13
13
  * hosts and that the project does not have yet.
14
14
  *
15
15
  * A split addon names one platform package per host in the `#host-addon` map
16
- * of its package.json (`<addon>-ios` covers every iOS host). Desktop platform
17
- * packages install as the addon's os/cpu-filtered optionalDependencies, but a
18
- * build host never reports a mobile os, so mobile ones have to be declared.
16
+ * of its package.json (`<addon>-ios` covers every iOS host) and loads its
17
+ * native code from that package alone. Desktop platform packages install as
18
+ * os/cpu-filtered optionalDependencies, but a build host never reports a
19
+ * mobile os, so mobile ones have to be declared.
19
20
  * This declares the missing ones in package.json, pinned to each addon's
20
21
  * exact version, using the project's own package manager.
21
22
  *
22
- * A host whose prebuild already resolves is skipped: a local
23
- * `prebuilds/<host>` in the addon (source builds) or its platform package at
24
- * the addon's version. Throws `HostPrebuildsInstallRefusedError` when no
23
+ * A host whose platform package is already installed at the addon's version
24
+ * is skipped. Throws `HostPrebuildsInstallRefusedError` when no
25
25
  * supported package manager (npm 7+, pnpm, bun, Yarn Berry) is found, and
26
26
  * `HostPrebuildsInstallFailedError` when the install does not produce the
27
27
  * packages.
@@ -131,24 +131,35 @@ async function choosePackageManager(projectRoot, requested, dependencies) {
131
131
  }
132
132
  /**
133
133
  * The installed addons named in `names`, or every installed addon when
134
- * `names` is omitted. For each name the copy in the nearest modules directory
135
- * wins, as it does for Node's resolver.
134
+ * `names` is omitted, split addon metas included. For each name the copy in
135
+ * the nearest modules directory wins, as it does for Node's resolver. Without
136
+ * `names`, the packages nested in each package's own node_modules count too.
136
137
  */
137
- async function resolveAddons(projectRoot, names, logger) {
138
+ export async function resolveAddons(projectRoot, names, logger) {
138
139
  const moduleDirs = await reachableModuleDirs(projectRoot);
139
140
  const wanted = names === undefined ? null : new Set(names);
140
141
  const found = new Map();
141
- for (const modulesDir of moduleDirs) {
142
+ const visited = new Set();
143
+ for (let i = 0; i < moduleDirs.length; i++) {
144
+ const modulesDir = moduleDirs[i];
142
145
  const candidates = wanted === null ? await listPackageNames(modulesDir) : [...wanted];
143
146
  for (const name of candidates) {
147
+ const packageDir = path.join(modulesDir, ...name.split('/'));
148
+ if (wanted === null) {
149
+ const nested = path.join(packageDir, 'node_modules');
150
+ const real = await realPath(nested);
151
+ if (real !== null && !visited.has(real)) {
152
+ visited.add(real);
153
+ moduleDirs.push(nested);
154
+ }
155
+ }
144
156
  if (found.has(name))
145
157
  continue;
146
- const result = await readAddonPackageJson({
147
- packageJsonPath: path.join(modulesDir, ...name.split('/'), 'package.json'),
148
- expectedName: name
149
- });
150
- if (result.addon !== undefined)
151
- found.set(name, result.addon);
158
+ const packageJsonPath = path.join(packageDir, 'package.json');
159
+ const result = await readAddonPackageJson({ packageJsonPath, expectedName: name });
160
+ const addon = result.addon ?? result.splitAddon?.addon;
161
+ if (addon !== undefined)
162
+ found.set(name, addon);
152
163
  }
153
164
  }
154
165
  for (const name of wanted ?? []) {
@@ -214,6 +225,14 @@ async function readDirNames(dir) {
214
225
  return [];
215
226
  }
216
227
  }
228
+ async function realPath(dir) {
229
+ try {
230
+ return await fsp.realpath(dir);
231
+ }
232
+ catch {
233
+ return null;
234
+ }
235
+ }
217
236
  async function isDirectory(dir) {
218
237
  try {
219
238
  return (await fsp.stat(dir)).isDirectory();
@@ -1,14 +1,14 @@
1
- export { bundleSdk } from './bundle/index.js';
2
- export type { BundleSdkOptions, BundleSdkResult } from './bundle/index.js';
3
- export { ensureHostPrebuilds } from './host-prebuilds/index.js';
4
- export type { EnsureHostPrebuildsOptions, EnsureHostPrebuildsResult, HostPrebuildPackage, PackageManagerName } from './host-prebuilds/index.js';
5
- export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from './verify/index.js';
6
- export type { VerifyBundleOptions, VerifyBundleResult, VerifyBundleIssue, RuntimeGroup } from './verify/index.js';
7
- export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError } from '../utils/errors-client.js';
8
- export { formatRuntimeSource } from './verify/abi.js';
9
- export type { BareRuntime, BareRuntimeResolution } from './verify/abi.js';
10
- export { isReactNativeBareKitInstalled } from './verify/bare-kit-runtime.js';
11
- export { isMobileHost } from './verify/prebuilds.js';
12
- export { formatEnginesAdvice } from './verify/engines-advice.js';
13
- export type { EnginesAdvice, EnginesOverride, EnginesUpgrade } from './verify/engines-advice.js';
1
+ export { bundleSdk } from '../commands/bundle/index.js';
2
+ export type { BundleSdkOptions, BundleSdkResult } from '../commands/bundle/index.js';
3
+ export { ensureHostPrebuilds } from '../commands/host-prebuilds/index.js';
4
+ export type { EnsureHostPrebuildsOptions, EnsureHostPrebuildsResult, HostPrebuildPackage, PackageManagerName } from '../commands/host-prebuilds/index.js';
5
+ export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from '../commands/verify/index.js';
6
+ export type { VerifyBundleOptions, VerifyBundleResult, VerifyBundleIssue, RuntimeGroup } from '../commands/verify/index.js';
7
+ export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError, HostPrebuildsMissingError } from '../utils/errors-client.js';
8
+ export { formatRuntimeSource } from '../commands/verify/abi.js';
9
+ export type { BareRuntime, BareRuntimeResolution } from '../commands/verify/abi.js';
10
+ export { isReactNativeBareKitInstalled } from '../commands/verify/bare-kit-runtime.js';
11
+ export { isMobileHost } from '../commands/verify/prebuilds.js';
12
+ export { formatEnginesAdvice } from '../commands/verify/engines-advice.js';
13
+ export type { EnginesAdvice, EnginesOverride, EnginesUpgrade } from '../commands/verify/engines-advice.js';
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
- export { bundleSdk } from './bundle/index.js';
2
- export { ensureHostPrebuilds } from './host-prebuilds/index.js';
3
- export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from './verify/index.js';
4
- export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError } from '../utils/errors-client.js';
5
- export { formatRuntimeSource } from './verify/abi.js';
6
- export { isReactNativeBareKitInstalled } from './verify/bare-kit-runtime.js';
7
- export { isMobileHost } from './verify/prebuilds.js';
8
- export { formatEnginesAdvice } from './verify/engines-advice.js';
1
+ export { bundleSdk } from '../commands/bundle/index.js';
2
+ export { ensureHostPrebuilds } from '../commands/host-prebuilds/index.js';
3
+ export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from '../commands/verify/index.js';
4
+ export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError, HostPrebuildsMissingError } from '../utils/errors-client.js';
5
+ export { formatRuntimeSource } from '../commands/verify/abi.js';
6
+ export { isReactNativeBareKitInstalled } from '../commands/verify/bare-kit-runtime.js';
7
+ export { isMobileHost } from '../commands/verify/prebuilds.js';
8
+ export { formatEnginesAdvice } from '../commands/verify/engines-advice.js';
@@ -1,4 +1,4 @@
1
- import { type NativeAddon } from './addon-source.js';
1
+ import { type NativeAddon } from '../../commands/verify/addon-source.js';
2
2
  export interface BareRuntime {
3
3
  version: string;
4
4
  source: 'flag' | 'config' | 'bare-runtime' | 'bare' | 'react-native-bare-kit';
@@ -1,7 +1,7 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import semver from 'semver';
4
- import { formatAddonId } from './addon-source.js';
4
+ import { formatAddonId } from '../../commands/verify/addon-source.js';
5
5
  const RUNTIME_PACKAGES = [
6
6
  { source: 'bare-runtime', packageName: 'bare-runtime' },
7
7
  { source: 'bare', packageName: 'bare' }
@@ -16,6 +16,7 @@ export interface AddonPackageJson {
16
16
  name?: string;
17
17
  version?: string;
18
18
  addon?: boolean;
19
+ imports?: Record<string, unknown>;
19
20
  engines?: {
20
21
  bare?: string;
21
22
  };
@@ -48,6 +49,17 @@ export interface ReadAddonPackageJsonResult {
48
49
  invalid?: InvalidPackageJsonRecord;
49
50
  addon?: NativeAddon;
50
51
  record?: PackageRecord;
52
+ /**
53
+ * Set for a split addon's meta package, which is not itself an addon: its
54
+ * `binding.js` is `require('#host-addon')` and the platform packages that
55
+ * map names (`<name>-<platform>`) are the addons actually loaded.
56
+ */
57
+ splitAddon?: SplitAddon;
58
+ }
59
+ export interface SplitAddon {
60
+ addon: NativeAddon;
61
+ /** Every platform package the meta's `#host-addon` map names. */
62
+ platformPackages: string[];
51
63
  }
52
64
  export declare function readAddonPackageJson(options: ReadAddonPackageJsonOptions): Promise<ReadAddonPackageJsonResult>;
53
65
  export interface CollectDiagnostics {
@@ -31,9 +31,13 @@ export async function readAddonPackageJson(options) {
31
31
  const pkg = parsed;
32
32
  const record = buildRecord(pkg, packageJsonPath, expectedName);
33
33
  if (pkg.addon !== true) {
34
- return record === null
35
- ? { found: true, isAddon: false }
36
- : { found: true, isAddon: false, record };
34
+ const result = { found: true, isAddon: false };
35
+ if (record !== null)
36
+ result.record = record;
37
+ const splitAddon = buildSplitAddon(pkg, packageJsonPath);
38
+ if (splitAddon !== null)
39
+ result.splitAddon = splitAddon;
40
+ return result;
37
41
  }
38
42
  const name = pkg.name ?? expectedName;
39
43
  if (!name) {
@@ -56,6 +60,35 @@ export async function readAddonPackageJson(options) {
56
60
  ? { found: true, isAddon: true, addon }
57
61
  : { found: true, isAddon: true, addon, record };
58
62
  }
63
+ function buildSplitAddon(pkg, packageJsonPath) {
64
+ if (typeof pkg.name !== 'string')
65
+ return null;
66
+ const prefix = `${pkg.name}-`;
67
+ const platformPackages = new Set();
68
+ const visit = (value) => {
69
+ if (typeof value === 'string') {
70
+ if (value.startsWith(prefix))
71
+ platformPackages.add(value);
72
+ }
73
+ else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
74
+ for (const child of Object.values(value))
75
+ visit(child);
76
+ }
77
+ };
78
+ visit(pkg.imports?.['#host-addon']);
79
+ if (platformPackages.size === 0)
80
+ return null;
81
+ const addon = {
82
+ name: pkg.name,
83
+ packageJsonPath,
84
+ packageRoot: path.dirname(packageJsonPath)
85
+ };
86
+ if (typeof pkg.version === 'string')
87
+ addon.version = pkg.version;
88
+ if (typeof pkg.engines?.bare === 'string')
89
+ addon.enginesBare = pkg.engines.bare;
90
+ return { addon, platformPackages: [...platformPackages].sort() };
91
+ }
59
92
  function stringRecord(value) {
60
93
  const out = {};
61
94
  if (typeof value !== 'object' || value === null || Array.isArray(value))
@@ -1,4 +1,4 @@
1
- import type { BareRuntimeResolution } from './abi.js';
1
+ import type { BareRuntimeResolution } from '../../commands/verify/abi.js';
2
2
  export declare const REACT_NATIVE_BARE_KIT = "react-native-bare-kit";
3
3
  export declare const NETWORK_TIMEOUT_MS = 5000;
4
4
  export type FetchText = (url: string) => Promise<string>;
@@ -1,7 +1,7 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import semver from 'semver';
4
- import { BARE_KIT_BARE_VERSIONS, REACT_NATIVE_BARE_KIT_RUNTIMES } from './bare-kit-runtimes.js';
4
+ import { BARE_KIT_BARE_VERSIONS, REACT_NATIVE_BARE_KIT_RUNTIMES } from '../../commands/verify/bare-kit-runtimes.js';
5
5
  import { findInAncestorNodeModules } from '../../expo/plugins/find-in-ancestor-node-modules.js';
6
6
  export const REACT_NATIVE_BARE_KIT = 'react-native-bare-kit';
7
7
  export const NETWORK_TIMEOUT_MS = 5000;
@@ -17,7 +17,8 @@ export const REACT_NATIVE_BARE_KIT_RUNTIMES = {
17
17
  '0.15.3': { bareKit: '2.5.1', bare: '1.33.2' },
18
18
  '0.15.4': { bareKit: '2.5.3', bare: '1.33.3' },
19
19
  '0.15.5': { bareKit: '2.5.4', bare: '1.33.4' },
20
- '0.15.6': { bareKit: '2.5.4', bare: '1.33.4' }
20
+ '0.15.6': { bareKit: '2.5.4', bare: '1.33.4' },
21
+ '0.16.0': { bareKit: '2.5.4', bare: '1.33.4' }
21
22
  };
22
23
  /** Bare version each bare-kit release is built against. */
23
24
  export const BARE_KIT_BARE_VERSIONS = {
@@ -1,4 +1,4 @@
1
- import { type CollectDiagnostics, type NativeAddon } from './addon-source.js';
1
+ import { type CollectDiagnostics, type NativeAddon } from '../../commands/verify/addon-source.js';
2
2
  export declare class InvalidBundleSourceError extends Error {
3
3
  bundlePath: string;
4
4
  constructor(bundlePath: string, cause: unknown);
@@ -1,8 +1,8 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { DEFAULT_HOSTS } from '../bundle/constants.js';
4
- import { buildNestedPathIndex, extractBarePackHeader, extractPackedString } from '../bundle/manifest.js';
5
- import { createLimiter, deduplicateAddons, FS_CONCURRENCY, readAddonPackageJson } from './addon-source.js';
3
+ import { DEFAULT_HOSTS } from '../../commands/bundle/constants.js';
4
+ import { buildNestedPathIndex, extractBarePackHeader, extractPackedString } from '../../commands/bundle/manifest.js';
5
+ import { createLimiter, deduplicateAddons, FS_CONCURRENCY, readAddonPackageJson } from '../../commands/verify/addon-source.js';
6
6
  /** bare-pack resolves a linked native addon to this prefix instead of a module path. */
7
7
  const LINKED_PREFIX = 'linked:';
8
8
  /** Reserved resolution key naming the package.json that owns a module. */
@@ -1,7 +1,7 @@
1
- import { type PackageManagerName } from '../host-prebuilds/package-manager.js';
2
- import { type BareRuntime } from './abi.js';
3
- import type { PackageRecord } from './addon-source.js';
4
- import { type ProgressFn } from './bare-kit-runtime.js';
1
+ import { type PackageManagerName } from '../../commands/host-prebuilds/package-manager.js';
2
+ import { type BareRuntime } from '../../commands/verify/abi.js';
3
+ import type { PackageRecord } from '../../commands/verify/addon-source.js';
4
+ import { type ProgressFn } from '../../commands/verify/bare-kit-runtime.js';
5
5
  export interface EnginesFailure {
6
6
  name: string;
7
7
  version?: string;
@@ -1,8 +1,8 @@
1
1
  import semver from 'semver';
2
- import { detectPackageManager } from '../host-prebuilds/package-manager.js';
3
- import { formatRuntimeSource } from './abi.js';
4
- import { findReactNativeBareKitUpgrade, NETWORK_TIMEOUT_MS, REACT_NATIVE_BARE_KIT } from './bare-kit-runtime.js';
5
- import { REACT_NATIVE_BARE_KIT_RUNTIMES } from './bare-kit-runtimes.js';
2
+ import { detectPackageManager } from '../../commands/host-prebuilds/package-manager.js';
3
+ import { formatRuntimeSource } from '../../commands/verify/abi.js';
4
+ import { findReactNativeBareKitUpgrade, NETWORK_TIMEOUT_MS, REACT_NATIVE_BARE_KIT } from '../../commands/verify/bare-kit-runtime.js';
5
+ import { REACT_NATIVE_BARE_KIT_RUNTIMES } from '../../commands/verify/bare-kit-runtimes.js';
6
6
  const REGISTRY_URL = 'https://registry.npmjs.org';
7
7
  /** The registry's abbreviated metadata lists `engines` per version at a fraction of the full size. */
8
8
  const ABBREVIATED_METADATA_TYPE = 'application/vnd.npm.install-v1+json';
@@ -1,8 +1,8 @@
1
- import { type AddonSourceKind, type NativeAddon } from './addon-source.js';
2
- import { type MissingPrebuildIssue } from './prebuilds.js';
3
- import { type AbiIssue, type BareRuntimeResolution } from './abi.js';
4
- import { type FetchText, type ProgressFn } from './bare-kit-runtime.js';
5
- import { type EnginesAdvice, type FetchPackageMetadata } from './engines-advice.js';
1
+ import { type AddonSourceKind, type NativeAddon } from '../../commands/verify/addon-source.js';
2
+ import { type MissingPrebuildIssue } from '../../commands/verify/prebuilds.js';
3
+ import { type AbiIssue, type BareRuntimeResolution } from '../../commands/verify/abi.js';
4
+ import { type FetchText, type ProgressFn } from '../../commands/verify/bare-kit-runtime.js';
5
+ import { type EnginesAdvice, type FetchPackageMetadata } from '../../commands/verify/engines-advice.js';
6
6
  export interface VerifyBundleOptions {
7
7
  projectRoot: string;
8
8
  addonsSource: string;
@@ -1,13 +1,13 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { resolveConfigFileInProject, loadConfigFromPath } from '../../client/config-loader/resolve-config.node.js';
4
- import { createCollectDiagnostics, formatAddonId } from './addon-source.js';
5
- import { collectAddonsFromBundle, InvalidBundleSourceError } from './bundle-source.js';
6
- import { collectAddonsFromNodeModules, InvalidNodeModulesSourceError } from './node-modules-source.js';
7
- import { checkPrebuilds, isMobileHost } from './prebuilds.js';
8
- import { checkAbi, formatConfigLabel, normalizeVersion, resolveBareRuntime } from './abi.js';
9
- import { isReactNativeBareKitInstalled, resolveMobileBareRuntime } from './bare-kit-runtime.js';
10
- import { buildEnginesAdvice, formatEnginesAdvice } from './engines-advice.js';
4
+ import { createCollectDiagnostics, formatAddonId } from '../../commands/verify/addon-source.js';
5
+ import { collectAddonsFromBundle, InvalidBundleSourceError } from '../../commands/verify/bundle-source.js';
6
+ import { collectAddonsFromNodeModules, InvalidNodeModulesSourceError } from '../../commands/verify/node-modules-source.js';
7
+ import { checkPrebuilds, isMobileHost } from '../../commands/verify/prebuilds.js';
8
+ import { checkAbi, formatConfigLabel, normalizeVersion, resolveBareRuntime } from '../../commands/verify/abi.js';
9
+ import { isReactNativeBareKitInstalled, resolveMobileBareRuntime } from '../../commands/verify/bare-kit-runtime.js';
10
+ import { buildEnginesAdvice, formatEnginesAdvice } from '../../commands/verify/engines-advice.js';
11
11
  export async function verifyBundle(options) {
12
12
  const { projectRoot, addonsSource, hosts, bareRuntimeVersion, configPath } = options;
13
13
  const resolvedAddonsSource = path.isAbsolute(addonsSource)
@@ -1,4 +1,4 @@
1
- import { type CollectDiagnostics, type NativeAddon } from './addon-source.js';
1
+ import { type CollectDiagnostics, type NativeAddon } from '../../commands/verify/addon-source.js';
2
2
  export declare class InvalidNodeModulesSourceError extends Error {
3
3
  nodeModulesPath: string;
4
4
  constructor(nodeModulesPath: string, cause: unknown);
@@ -1,6 +1,6 @@
1
1
  import { promises as fsp } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { createLimiter, deduplicateAddons, FS_CONCURRENCY, readAddonPackageJson } from './addon-source.js';
3
+ import { createLimiter, deduplicateAddons, FS_CONCURRENCY, readAddonPackageJson } from '../../commands/verify/addon-source.js';
4
4
  export class InvalidNodeModulesSourceError extends Error {
5
5
  nodeModulesPath;
6
6
  constructor(nodeModulesPath, cause) {
@@ -16,7 +16,11 @@ export async function collectAddonsFromNodeModules(options) {
16
16
  const { nodeModulesRoot, diagnostics } = options;
17
17
  const limit = createLimiter(FS_CONCURRENCY);
18
18
  const results = await walkNodeModules(nodeModulesRoot, limit, true);
19
+ // A split addon is checked through its meta, which looks for each host's
20
+ // prebuild in the platform package it names; checking the installed
21
+ // platform packages as well would fail each one on every other host.
19
22
  const addons = [];
23
+ const platformPackages = new Set();
20
24
  for (const result of results) {
21
25
  if (result.record !== undefined && diagnostics !== undefined) {
22
26
  diagnostics.packages.push(result.record);
@@ -24,11 +28,16 @@ export async function collectAddonsFromNodeModules(options) {
24
28
  if (result.isAddon && result.addon) {
25
29
  addons.push(result.addon);
26
30
  }
31
+ else if (result.splitAddon !== undefined) {
32
+ addons.push(result.splitAddon.addon);
33
+ for (const name of result.splitAddon.platformPackages)
34
+ platformPackages.add(name);
35
+ }
27
36
  else if (result.invalid !== undefined && diagnostics !== undefined) {
28
37
  diagnostics.invalidPackageJsons.push(result.invalid);
29
38
  }
30
39
  }
31
- return deduplicateAddons(addons);
40
+ return deduplicateAddons(addons.filter((addon) => !platformPackages.has(addon.name)));
32
41
  }
33
42
  /**
34
43
  * Directory reads run in parallel under `limit`; results are concatenated in
@@ -1,13 +1,9 @@
1
+ /**
2
+ * Resolves split-addon platform packages from the meta package's `#host-addon`
3
+ * map, so verify and the missing-prebuild error name the package the addon
4
+ * actually imports.
5
+ */
1
6
  export declare const HOST_ADDON_IMPORT = "#host-addon";
2
- export interface PlatformAddonRoot {
3
- dir: string;
4
- pkg: {
5
- name?: string;
6
- version?: string;
7
- addon?: boolean;
8
- };
9
- }
10
- export declare function resolvePlatformAddonRoots(projectRoot: string, addonNames: string[], platform: string): PlatformAddonRoot[];
11
7
  /**
12
8
  * Package `#host-addon` names for `host`, if that name belongs to `metaName`.
13
9
  * `host` is a Bare host (`android-arm64`, `ios-arm64-simulator`, `darwin-arm64`)
@@ -20,4 +16,4 @@ export declare function resolveAddonPlatformPackage(metaName: string, hostAddon:
20
16
  * A platform-only `android` target uses arm64, matching the current mobile host.
21
17
  */
22
18
  export declare function resolvePlatformPackageName(hostAddon: unknown, host: string): string | null;
23
- //# sourceMappingURL=qvac-platform-addons.d.ts.map
19
+ //# sourceMappingURL=platform-addons.d.ts.map
@@ -1,53 +1,10 @@
1
1
  /**
2
2
  * Resolves split-addon platform packages from the meta package's `#host-addon`
3
- * map. Linker, verify, and the missing-prebuild error all call this module so
4
- * the slice name cannot drift from what the addon actually imports.
5
- *
6
- * Keep this file free of `@/` imports: the compiled JS is copied next to the
7
- * patched `link.mjs` as `qvac-platform-addons.mjs`.
3
+ * map, so verify and the missing-prebuild error name the package the addon
4
+ * actually imports.
8
5
  */
9
- import * as fs from 'fs';
10
- import * as path from 'path';
11
6
  export const HOST_ADDON_IMPORT = '#host-addon';
12
7
  const DEFAULT_ANDROID_CPU = 'arm64';
13
- export function resolvePlatformAddonRoots(projectRoot, addonNames, platform) {
14
- const roots = [];
15
- for (const name of addonNames) {
16
- const root = resolvePlatformAddonRoot(projectRoot, name, platform);
17
- if (root !== null)
18
- roots.push(root);
19
- }
20
- return roots;
21
- }
22
- function resolvePlatformAddonRoot(projectRoot, metaName, platform) {
23
- const metaManifest = readManifest(packageDir(projectRoot, metaName));
24
- if (metaManifest === null)
25
- return null;
26
- const platformPackage = resolveAddonPlatformPackage(metaName, metaManifest.imports?.[HOST_ADDON_IMPORT], platform);
27
- if (platformPackage === null)
28
- return null;
29
- const addonDir = path.join(packageDir(projectRoot, platformPackage), 'addon');
30
- const addonManifest = readManifest(addonDir);
31
- if (addonManifest === null || addonManifest.addon !== true)
32
- return null;
33
- if (!fs.existsSync(path.join(addonDir, 'prebuilds')))
34
- return null;
35
- return { dir: addonDir, pkg: addonManifest };
36
- }
37
- function packageDir(projectRoot, packageName) {
38
- return path.join(projectRoot, 'node_modules', ...packageName.split('/'));
39
- }
40
- function readManifest(dir) {
41
- try {
42
- const parsed = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
43
- if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
44
- return null;
45
- return parsed;
46
- }
47
- catch {
48
- return null;
49
- }
50
- }
51
8
  /**
52
9
  * Package `#host-addon` names for `host`, if that name belongs to `metaName`.
53
10
  * `host` is a Bare host (`android-arm64`, `ios-arm64-simulator`, `darwin-arm64`)
@@ -1,4 +1,4 @@
1
- import { type NativeAddon } from './addon-source.js';
1
+ import { type NativeAddon } from '../../commands/verify/addon-source.js';
2
2
  export interface MissingPrebuildIssue {
3
3
  code: 'missing-prebuild';
4
4
  level: 'error';
@@ -40,17 +40,14 @@ export interface PrebuildLocation {
40
40
  mismatchedVersion?: string;
41
41
  }
42
42
  /**
43
- * Directories to search for an addon's `<host>` prebuild, in precedence order:
43
+ * Where an addon's `<host>` prebuild may live:
44
44
  *
45
- * 1. `<packageRoot>/prebuilds/<host>` — the fat layout every addon used to
46
- * publish, and where source builds and `linked:` checkouts still land.
47
- * 2. `<platformRoot>/addon/prebuilds/<host>` — the per-platform package the
48
- * addon's `#host-addon` map names for this host, when that package is
49
- * installed. Each platform package embeds an inner `addon/` package named
50
- * after the meta addon so the `.bare` file keeps its name.
51
- *
52
- * A local `prebuilds/` always wins, matching the precedence the addons apply
53
- * in their own `binding.js` (`require.addon()` first, platform package second).
45
+ * - `<packageRoot>/prebuilds/<host>` for an ordinary addon, including the
46
+ * per-platform packages themselves.
47
+ * - For a split addon, the platform package its `#host-addon` map names for
48
+ * this host: `<platformRoot>/prebuilds/<host>` when that package is an
49
+ * addon, `<platformRoot>/addon/prebuilds/<host>` when it wraps an inner
50
+ * addon. Empty when the package is not installed.
54
51
  */
55
52
  export declare function resolvePrebuildLocations(addon: NativeAddon, host: string): Promise<PrebuildLocation[]>;
56
53
  export declare function checkPrebuilds(options: CheckPrebuildsOptions): Promise<MissingPrebuildIssue[]>;