@qvac/sdk 0.23.0 → 0.24.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/NOTICE +115 -58
- package/README.md +10 -13
- package/dist/examples/asr/parakeet-sortformer.js +24 -14
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +40 -11
- package/dist/examples/asr/parakeet-unified-coreml.js +14 -9
- package/dist/examples/asr/whispercpp-prompt.js +9 -5
- package/dist/examples/assess-model-fit.d.ts +7 -9
- package/dist/examples/assess-model-fit.js +22 -43
- package/dist/examples/calc-tokens.d.ts +2 -0
- package/dist/examples/calc-tokens.js +21 -0
- package/dist/examples/classification/classify-image.js +11 -5
- package/dist/examples/completion-stop-reason.d.ts +3 -3
- package/dist/examples/completion-stop-reason.js +4 -4
- package/dist/examples/diffusion-flux3-klein.d.ts +2 -0
- package/dist/examples/diffusion-flux3-klein.js +102 -0
- package/dist/examples/diffusion-moss-image.d.ts +2 -0
- package/dist/examples/diffusion-moss-image.js +126 -0
- package/dist/examples/diffusion-qwen-image-21.js +15 -4
- package/dist/examples/embed-multimodal.d.ts +2 -0
- package/dist/examples/embed-multimodal.js +80 -0
- package/dist/examples/embed-p2p.js +2 -2
- package/dist/examples/image/megaloc.d.ts +2 -0
- package/dist/examples/image/megaloc.js +37 -0
- package/dist/examples/llamacpp-multimodal.js +18 -0
- package/dist/examples/rag/rag-hyperdb/pipeline.js +2 -2
- package/dist/examples/rag/rag-turbovec.js +2 -2
- package/dist/examples/sessions.d.ts +17 -0
- package/dist/examples/sessions.js +63 -0
- package/dist/examples/tools/llamacpp-deferred-tools.js +8 -4
- package/dist/scripts/check-resource-collectors-packaging.js +7 -6
- package/dist/scripts/contract/build-contract.d.ts +2 -1
- package/dist/scripts/contract/build-contract.js +13 -1
- package/dist/scripts/contract/constants-registry.d.ts +17 -0
- package/dist/scripts/contract/constants-registry.js +8 -2
- package/dist/scripts/contract/method-shapes.d.ts +4 -0
- package/dist/scripts/contract/method-shapes.js +4 -0
- package/dist/scripts/enforce-inference-versions.d.ts +1 -1
- package/dist/scripts/enforce-inference-versions.js +28 -18
- package/dist/scripts/generate-bare-kit-runtimes.js +101 -69
- package/dist/src/client/api/assess-model-fit.d.ts +17 -17
- package/dist/src/client/api/assess-model-fit.js +18 -31
- package/dist/src/client/api/audio-edit.d.ts +5 -3
- package/dist/src/client/api/audio-edit.js +5 -3
- package/dist/src/client/api/audio-gen-result.js +134 -45
- package/dist/src/client/api/audio-gen.d.ts +40 -3
- package/dist/src/client/api/audio-gen.js +40 -3
- package/dist/src/client/api/audio-understand.d.ts +2 -2
- package/dist/src/client/api/audio-understand.js +2 -2
- package/dist/src/client/api/batch-completion.js +2 -1
- package/dist/src/client/api/calc-tokens.d.ts +33 -0
- package/dist/src/client/api/calc-tokens.js +44 -0
- package/dist/src/client/api/cancel.d.ts +2 -2
- package/dist/src/client/api/cancel.js +2 -2
- package/dist/src/client/api/classify.d.ts +12 -5
- package/dist/src/client/api/classify.js +17 -5
- package/dist/src/client/api/client-request-id.d.ts +0 -15
- package/dist/src/client/api/client-request-id.js +15 -12
- package/dist/src/client/api/completion-stream.d.ts +8 -1
- package/dist/src/client/api/completion-stream.js +10 -1
- package/dist/src/client/api/delete-cache.d.ts +9 -2
- package/dist/src/client/api/delete-cache.js +13 -3
- package/dist/src/client/api/diffusion.d.ts +20 -4
- package/dist/src/client/api/diffusion.js +23 -5
- package/dist/src/client/api/embed.d.ts +82 -29
- package/dist/src/client/api/embed.js +64 -19
- package/dist/src/client/api/get-model-info.d.ts +2 -2
- package/dist/src/client/api/get-model-info.js +2 -2
- package/dist/src/client/api/get-system-resources.d.ts +2 -2
- package/dist/src/client/api/get-system-resources.js +2 -2
- package/dist/src/client/api/heartbeat.d.ts +3 -2
- package/dist/src/client/api/heartbeat.js +3 -2
- package/dist/src/client/api/index.d.ts +4 -3
- package/dist/src/client/api/index.js +2 -1
- package/dist/src/client/api/invoke-plugin.d.ts +8 -2
- package/dist/src/client/api/invoke-plugin.js +17 -2
- package/dist/src/client/api/load-model.js +5 -2
- package/dist/src/client/api/ocr.d.ts +5 -3
- package/dist/src/client/api/ocr.js +44 -21
- package/dist/src/client/api/rag.d.ts +1 -1
- package/dist/src/client/api/rag.js +1 -1
- package/dist/src/client/api/registry.d.ts +17 -7
- package/dist/src/client/api/registry.js +37 -12
- package/dist/src/client/api/resume.d.ts +2 -1
- package/dist/src/client/api/resume.js +2 -2
- package/dist/src/client/api/rpc-server.d.ts +4 -4
- package/dist/src/client/api/rpc-server.js +10 -10
- package/dist/src/client/api/state.d.ts +2 -2
- package/dist/src/client/api/state.js +2 -2
- package/dist/src/client/api/subscribe-logs.d.ts +2 -2
- package/dist/src/client/api/subscribe-logs.js +2 -2
- package/dist/src/client/api/suspend.d.ts +4 -2
- package/dist/src/client/api/suspend.js +4 -3
- package/dist/src/client/api/text-to-speech.d.ts +14 -5
- package/dist/src/client/api/text-to-speech.js +83 -29
- package/dist/src/client/api/transcribe.d.ts +6 -2
- package/dist/src/client/api/transcribe.js +7 -1
- package/dist/src/client/api/unload-model.d.ts +19 -7
- package/dist/src/client/api/unload-model.js +29 -11
- package/dist/src/client/api/upscale.d.ts +6 -3
- package/dist/src/client/api/upscale.js +9 -4
- package/dist/src/client/api/vector-index.d.ts +50 -16
- package/dist/src/client/api/vector-index.js +100 -48
- package/dist/src/client/api/video-request.d.ts +5 -5
- package/dist/src/client/api/video.d.ts +3 -2
- package/dist/src/client/api/video.js +3 -2
- package/dist/src/client/api/vla.d.ts +9 -5
- package/dist/src/client/api/vla.js +17 -8
- package/dist/src/client/api/world.d.ts +5 -5
- package/dist/src/client/api/world.js +4 -4
- package/dist/src/client/init-hooks.d.ts +6 -4
- package/dist/src/client/init-hooks.js +12 -15
- package/dist/src/client/logging-stream-registry.d.ts +6 -3
- package/dist/src/client/logging-stream-registry.js +31 -12
- package/dist/src/client/rpc/bundle-stamp.d.ts +29 -0
- package/dist/src/client/rpc/bundle-stamp.js +75 -0
- package/dist/src/client/rpc/expo-home-dir.d.ts +2 -0
- package/dist/src/client/rpc/expo-home-dir.js +4 -0
- package/dist/src/client/rpc/expo-rpc-client.js +189 -135
- package/dist/src/client/rpc/node-rpc-client.js +322 -413
- package/dist/src/client/rpc/pear-runtime.d.ts +12 -0
- package/dist/src/client/rpc/pear-runtime.js +12 -0
- package/dist/src/client/rpc/rpc-client.d.ts +5 -4
- package/dist/src/client/rpc/rpc-client.js +126 -23
- package/dist/src/client/rpc/rpc-error.js +21 -2
- package/dist/src/client/rpc/unbundled-harness.d.ts +16 -0
- package/dist/src/client/rpc/unbundled-harness.js +27 -0
- package/dist/src/client/rpc/worker-failure.d.ts +27 -0
- package/dist/src/client/rpc/worker-failure.js +61 -0
- package/dist/src/client/session-registry.d.ts +75 -0
- package/dist/src/client/session-registry.js +149 -0
- package/dist/src/client/session.d.ts +125 -0
- package/dist/src/client/session.js +148 -0
- package/dist/src/commands/bundle/addons.d.ts +14 -0
- package/dist/src/commands/bundle/addons.js +65 -0
- package/dist/src/commands/bundle/constants.js +1 -0
- package/dist/src/commands/bundle/entry-gen.d.ts +1 -5
- package/dist/src/commands/bundle/entry-gen.js +17 -50
- package/dist/src/commands/bundle/index.d.ts +59 -13
- package/dist/src/commands/bundle/index.js +345 -121
- package/dist/src/commands/bundle/link.d.ts +58 -0
- package/dist/src/commands/bundle/link.js +135 -0
- package/dist/src/commands/bundle/node-support.d.ts +13 -0
- package/dist/src/commands/bundle/node-support.js +23 -0
- package/dist/src/commands/bundle/read-bundle.d.ts +9 -0
- package/dist/src/commands/bundle/read-bundle.js +27 -0
- package/dist/src/commands/bundle/resolve-sdk-import.d.ts +6 -0
- package/dist/src/commands/bundle/resolve-sdk-import.js +24 -28
- package/dist/src/commands/bundle/scratch.d.ts +35 -0
- package/dist/src/commands/bundle/scratch.js +178 -0
- package/dist/src/commands/bundle/targets.d.ts +14 -0
- package/dist/src/commands/bundle/targets.js +37 -0
- package/dist/src/commands/host-prebuilds/index.d.ts +5 -4
- package/dist/src/commands/host-prebuilds/index.js +9 -7
- package/dist/src/commands/index.d.ts +4 -3
- package/dist/src/commands/verify/abi.d.ts +20 -14
- package/dist/src/commands/verify/abi.js +11 -79
- package/dist/src/commands/verify/bare-kit-runtime.d.ts +20 -22
- package/dist/src/commands/verify/bare-kit-runtime.js +102 -150
- package/dist/src/commands/verify/bare-kit-runtimes.d.ts +10 -9
- package/dist/src/commands/verify/bare-kit-runtimes.js +21 -21
- package/dist/src/commands/verify/bundle-source.js +25 -21
- package/dist/src/commands/verify/engines-advice.d.ts +2 -8
- package/dist/src/commands/verify/engines-advice.js +7 -54
- package/dist/src/commands/verify/index.d.ts +30 -29
- package/dist/src/commands/verify/index.js +92 -200
- package/dist/src/commands/verify/prebuilds.d.ts +3 -5
- package/dist/src/commands/verify/prebuilds.js +1 -2
- package/dist/src/commands/verify/resource-collectors.d.ts +0 -6
- package/dist/src/commands/verify/resource-collectors.js +1 -50
- package/dist/src/commands/verify/sidecar-runtime.d.ts +6 -0
- package/dist/src/commands/verify/sidecar-runtime.js +51 -0
- package/dist/src/expo/plugins/withBareKit.d.ts +59 -0
- package/dist/src/expo/plugins/withBareKit.js +204 -0
- package/dist/src/expo/plugins/withMobileBundle.d.ts +4 -11
- package/dist/src/expo/plugins/withMobileBundle.js +36 -57
- package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -0
- package/dist/src/expo/plugins/withQvacSDK.js +3 -0
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.js +10 -14
- package/dist/src/logging/utils.js +10 -2
- package/dist/src/plugin-ids.d.ts +2 -1
- package/dist/src/plugin-ids.js +2 -0
- package/dist/src/schemas/public.d.ts +1 -1
- package/dist/src/schemas/public.js +1 -1
- package/dist/src/schemas/sdk-errors-client.d.ts +5 -6
- package/dist/src/schemas/sdk-errors-client.js +30 -36
- package/dist/src/schemas/sdk-errors-server.d.ts +11 -1
- package/dist/src/schemas/sdk-errors-server.js +60 -2
- package/dist/src/server/rpc/rpc-utils.d.ts +25 -4
- package/dist/src/server/rpc/rpc-utils.js +39 -5
- package/dist/src/utils/errors-client.d.ts +37 -29
- package/dist/src/utils/errors-client.js +50 -41
- package/dist/src/utils/errors-server.d.ts +59 -1
- package/dist/src/utils/errors-server.js +110 -1
- package/dist/src/utils/withTimeout.js +34 -17
- package/dist/src/worker/handle-request.js +25 -22
- package/dist/src/worker/handler-utils.d.ts +2 -6
- package/dist/src/worker/handler-utils.js +2 -20
- package/dist/src/worker/index.d.ts +2 -4
- package/dist/src/worker/index.js +23 -35
- package/dist/src/worker/plugins/ggml-image-embedding.d.ts +2 -0
- package/dist/src/worker/plugins/ggml-image-embedding.js +1 -0
- package/dist/src/worker/shim.d.ts +4 -0
- package/dist/src/worker/shim.js +7 -0
- package/dist/src/worker/start.d.ts +9 -0
- package/dist/src/worker/start.js +16 -0
- package/dist/src/worker/unbundled-shim.d.ts +2 -0
- package/dist/src/worker/unbundled-shim.js +4 -0
- package/docs/system-resources-support-matrix.md +27 -19
- package/package.json +62 -51
- package/src/electron-forge/index.cjs +65 -91
- package/dist/examples/model-fit-ui/server.d.ts +0 -24
- package/dist/examples/model-fit-ui/server.js +0 -221
- package/dist/src/client/rpc/ensure-worker-ready.d.ts +0 -9
- package/dist/src/client/rpc/ensure-worker-ready.js +0 -17
- package/dist/src/client/rpc/init-timeout.d.ts +0 -26
- package/dist/src/client/rpc/init-timeout.js +0 -25
- package/dist/src/client/rpc/ipc-socket-path.d.ts +0 -11
- package/dist/src/client/rpc/ipc-socket-path.js +0 -30
- package/dist/src/client/rpc/worker-startup-error.d.ts +0 -12
- package/dist/src/client/rpc/worker-startup-error.js +0 -13
- package/dist/src/commands/bundle/bare-pack.d.ts +0 -21
- package/dist/src/commands/bundle/bare-pack.js +0 -77
- package/dist/src/commands/bundle/manifest.d.ts +0 -25
- package/dist/src/commands/bundle/manifest.js +0 -192
- package/dist/src/expo/plugins/link-addons.d.ts +0 -18
- package/dist/src/expo/plugins/link-addons.js +0 -65
- package/dist/src/pear/pre.d.ts +0 -21
- package/dist/src/pear/pre.js +0 -450
- package/dist/src/server/env.d.ts +0 -22
- package/dist/src/server/env.js +0 -59
- package/dist/src/server/utils/qvac-paths.d.ts +0 -2
- package/dist/src/server/utils/qvac-paths.js +0 -5
- package/dist/src/server/utils/worker-lock.d.ts +0 -3
- package/dist/src/server/utils/worker-lock.js +0 -67
- package/dist/src/worker/create-server.d.ts +0 -8
- package/dist/src/worker/create-server.js +0 -51
- package/dist/src/worker/lifecycle.d.ts +0 -23
- package/dist/src/worker/lifecycle.js +0 -149
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { promises as fsp } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
|
+
import stow from 'bare-stow';
|
|
5
|
+
import semver from 'semver';
|
|
6
|
+
import { discardScratch, removeStaleScratch, scratchFolderFor } from '../../commands/bundle/scratch.js';
|
|
7
|
+
import { findInAncestorNodeModules } from '../../expo/plugins/find-in-ancestor-node-modules.js';
|
|
8
|
+
import { AddonLinkFailedError, ReactNativeBareKitUnsupportedError } from '../../utils/errors-client.js';
|
|
9
|
+
const REACT_NATIVE_BARE_KIT = 'react-native-bare-kit';
|
|
10
|
+
const { link, resources } = stow;
|
|
11
|
+
/** The folder of the app's assets in a linked module, which an iOS app copies into its bundle. */
|
|
12
|
+
export const BARE_KIT_RESOURCES = resources;
|
|
13
|
+
async function readManifest(dir) {
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(await fsp.readFile(path.join(dir, 'package.json'), 'utf8'));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Checks the installed react-native-bare-kit against the SDK's peer range for it. */
|
|
22
|
+
export async function assertReactNativeBareKitSupported(projectRoot, sdkPath) {
|
|
23
|
+
const bareKitDir = findInAncestorNodeModules(projectRoot, REACT_NATIVE_BARE_KIT);
|
|
24
|
+
if (bareKitDir === null)
|
|
25
|
+
return;
|
|
26
|
+
const required = (await readManifest(sdkPath))?.peerDependencies?.[REACT_NATIVE_BARE_KIT];
|
|
27
|
+
const installed = (await readManifest(bareKitDir))?.version;
|
|
28
|
+
if (typeof required !== 'string' || typeof installed !== 'string')
|
|
29
|
+
return;
|
|
30
|
+
if (semver.satisfies(installed, required, { includePrerelease: true }))
|
|
31
|
+
return;
|
|
32
|
+
throw new ReactNativeBareKitUnsupportedError(installed, required);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The module each phone platform's app builds Bare Kit and the native addons
|
|
36
|
+
* from, relative to the project root.
|
|
37
|
+
*/
|
|
38
|
+
export const NATIVE_MODULES = {
|
|
39
|
+
android: {
|
|
40
|
+
prefix: 'android-',
|
|
41
|
+
dir: path.join('android', 'qvac-bare-kit'),
|
|
42
|
+
language: 'kotlin',
|
|
43
|
+
languageOptions: { package: 'io.tether.qvac.sdk.addons' }
|
|
44
|
+
},
|
|
45
|
+
ios: {
|
|
46
|
+
prefix: 'ios-',
|
|
47
|
+
dir: path.join('ios', 'QvacBareKit'),
|
|
48
|
+
language: 'swift',
|
|
49
|
+
languageOptions: {}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const BARE_KIT_SWIFT_FROM = /(\.package\(url: "https:\/\/github\.com\/holepunchto\/bare-kit-swift(?:\.git)?", )from: /;
|
|
53
|
+
/**
|
|
54
|
+
* Pins bare-kit-swift at the version bare-stow names. bare-stow writes it as a
|
|
55
|
+
* minimum, which Swift Package Manager resolves at the newest release, so the
|
|
56
|
+
* app would run a newer Bare than the one its addons were checked against.
|
|
57
|
+
*/
|
|
58
|
+
export function pinBareKitSwift(manifest) {
|
|
59
|
+
return manifest.replace(BARE_KIT_SWIFT_FROM, '$1exact: ');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Links each phone platform's native module for `hosts`, holding Bare Kit and
|
|
63
|
+
* the native addons the worker loads, into a scratch folder. Returns the files
|
|
64
|
+
* as they will be named in the app, and the staged folders for `replaceAll`;
|
|
65
|
+
* the caller discards them. A failed link discards its own.
|
|
66
|
+
*/
|
|
67
|
+
export async function stageAddons(options) {
|
|
68
|
+
const { projectRoot, entryPath, hosts, imports, defer, logger } = options;
|
|
69
|
+
const staged = [];
|
|
70
|
+
const written = [];
|
|
71
|
+
try {
|
|
72
|
+
for (const module of Object.values(NATIVE_MODULES)) {
|
|
73
|
+
const platformHosts = hosts.filter((host) => host.startsWith(module.prefix));
|
|
74
|
+
if (platformHosts.length === 0)
|
|
75
|
+
continue;
|
|
76
|
+
// bare-link signs Apple frameworks with codesign.
|
|
77
|
+
if (module.language === 'swift' && process.platform !== 'darwin') {
|
|
78
|
+
logger.warn(`Linking iOS addons needs macOS; skipped ${platformHosts.join(', ')}.`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const out = path.join(projectRoot, module.dir);
|
|
82
|
+
await removeStaleScratch(out);
|
|
83
|
+
const scratch = await scratchFolderFor(out);
|
|
84
|
+
staged.push({ dir: out, next: scratch });
|
|
85
|
+
const platformWritten = [];
|
|
86
|
+
try {
|
|
87
|
+
for await (const { url } of link(pathToFileURL(entryPath).href, 'bare-kit', pathToFileURL(scratch).href, {
|
|
88
|
+
language: module.language,
|
|
89
|
+
languageOptions: module.languageOptions,
|
|
90
|
+
hosts: platformHosts,
|
|
91
|
+
...(imports !== undefined && { imports }),
|
|
92
|
+
defer
|
|
93
|
+
})) {
|
|
94
|
+
const file = path.join(out, path.relative(scratch, fileURLToPath(url.href)));
|
|
95
|
+
logger.debug(`Linked ${path.relative(projectRoot, file)}`);
|
|
96
|
+
platformWritten.push(file);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
throw new AddonLinkFailedError(platformHosts, error);
|
|
101
|
+
}
|
|
102
|
+
if (module.language === 'swift') {
|
|
103
|
+
// Xcode requires the folder of the assets, even when there are none.
|
|
104
|
+
await fsp.mkdir(path.join(scratch, BARE_KIT_RESOURCES), { recursive: true });
|
|
105
|
+
const manifest = path.join(scratch, 'Package.swift');
|
|
106
|
+
await fsp.writeFile(manifest, pinBareKitSwift(await fsp.readFile(manifest, 'utf8')));
|
|
107
|
+
}
|
|
108
|
+
warnOverwritten(platformWritten, out, logger);
|
|
109
|
+
written.push(...platformWritten);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
for (const { next } of staged)
|
|
114
|
+
await discardScratch(next);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
return { written, staged };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Addons that ship a library under the same name write it to the same path,
|
|
121
|
+
* and the copy linked last is the one the app loads.
|
|
122
|
+
*/
|
|
123
|
+
export function warnOverwritten(written, out, logger) {
|
|
124
|
+
const seen = new Set();
|
|
125
|
+
const overwritten = new Set();
|
|
126
|
+
for (const file of written) {
|
|
127
|
+
if (seen.has(file))
|
|
128
|
+
overwritten.add(file);
|
|
129
|
+
seen.add(file);
|
|
130
|
+
}
|
|
131
|
+
if (overwritten.size === 0)
|
|
132
|
+
return;
|
|
133
|
+
const files = [...overwritten].map((file) => path.relative(out, file)).sort();
|
|
134
|
+
logger.warn(`Several native addons ship ${files.join(', ')}; only the copy linked last is kept.`);
|
|
135
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const BARE_PACK_NODE_ENGINES = "^22.21.0 || >=24.9.0";
|
|
2
|
+
export declare function isBarePackNodeSupported(version: string): boolean;
|
|
3
|
+
export interface NodeVersions {
|
|
4
|
+
node: string;
|
|
5
|
+
bun?: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Bundling runs the lexer in this process, so `versions.node` is the Node that
|
|
9
|
+
* loads it. Bun loads it too but reports an emulated Node version, so it is
|
|
10
|
+
* not checked.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertNodeCanBundle(nodeVersions?: NodeVersions): void;
|
|
13
|
+
//# sourceMappingURL=node-support.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { versions } from 'node:process';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
import { BarePackNodeUnsupportedError } from '../../utils/errors-client.js';
|
|
4
|
+
// bare-module-lexer (loaded by bare-stow through bare-module-traverse) calls
|
|
5
|
+
// js_is_sharedarraybuffer from its native addon, which Node outside this range
|
|
6
|
+
// lacks; the bundling process crashes instead of throwing. Same range as
|
|
7
|
+
// engines.node in @qvac/cli.
|
|
8
|
+
export const BARE_PACK_NODE_ENGINES = '^22.21.0 || >=24.9.0';
|
|
9
|
+
export function isBarePackNodeSupported(version) {
|
|
10
|
+
return semver.satisfies(version, BARE_PACK_NODE_ENGINES, { includePrerelease: true });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Bundling runs the lexer in this process, so `versions.node` is the Node that
|
|
14
|
+
* loads it. Bun loads it too but reports an emulated Node version, so it is
|
|
15
|
+
* not checked.
|
|
16
|
+
*/
|
|
17
|
+
export function assertNodeCanBundle(nodeVersions = versions) {
|
|
18
|
+
if (nodeVersions.bun !== undefined)
|
|
19
|
+
return;
|
|
20
|
+
if (isBarePackNodeSupported(nodeVersions.node))
|
|
21
|
+
return;
|
|
22
|
+
throw new BarePackNodeUnsupportedError(nodeVersions.node, BARE_PACK_NODE_ENGINES);
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Bundle from 'bare-bundle';
|
|
2
|
+
export declare function readBundle(bundlePath: string): Promise<Bundle>;
|
|
3
|
+
/**
|
|
4
|
+
* The folder a bundle's module paths start from: the project root, or the
|
|
5
|
+
* folder above it that holds an SDK from outside the project, which `main`
|
|
6
|
+
* shows by naming the project's path below it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function bundleRoot(main: string | null | undefined, projectRoot: string): string;
|
|
9
|
+
//# sourceMappingURL=read-bundle.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { promises as fsp } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import Bundle from 'bare-bundle';
|
|
4
|
+
// The JavaScript wrappers bare-stow writes around an encoded bundle.
|
|
5
|
+
const ENCODED_PREFIXES = ['module.exports = ', 'export default '];
|
|
6
|
+
/** The shim bare-stow writes beside `qvac/worker.entry.mjs`, which a bundle names as `main`. */
|
|
7
|
+
const ENTRY_SHIM = '/qvac/__main__.cjs';
|
|
8
|
+
export async function readBundle(bundlePath) {
|
|
9
|
+
const data = await fsp.readFile(bundlePath);
|
|
10
|
+
for (const prefix of ENCODED_PREFIXES) {
|
|
11
|
+
if (data.subarray(0, prefix.length).toString() === prefix) {
|
|
12
|
+
return Bundle.from(JSON.parse(data.subarray(prefix.length).toString()));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return Bundle.from(data);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The folder a bundle's module paths start from: the project root, or the
|
|
19
|
+
* folder above it that holds an SDK from outside the project, which `main`
|
|
20
|
+
* shows by naming the project's path below it.
|
|
21
|
+
*/
|
|
22
|
+
export function bundleRoot(main, projectRoot) {
|
|
23
|
+
if (!main?.endsWith(ENTRY_SHIM))
|
|
24
|
+
return projectRoot;
|
|
25
|
+
const depth = main.slice(0, -ENTRY_SHIM.length).split('/').filter(Boolean).length;
|
|
26
|
+
return path.resolve(projectRoot, ...Array(depth).fill('..'));
|
|
27
|
+
}
|
|
@@ -2,5 +2,11 @@ export type SdkExportEntry = string | {
|
|
|
2
2
|
[condition: string]: SdkExportEntry;
|
|
3
3
|
};
|
|
4
4
|
export declare function selectExportTarget(entry: SdkExportEntry | undefined): string | null;
|
|
5
|
+
export declare function sdkImportsMap(sdkPath: string, sdkName: string): Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Maps `<sdkName>/<subpath>` to the file the SDK at `sdkPath` exports for it,
|
|
8
|
+
* so a worker entry reaches an SDK that the project's own `node_modules` does
|
|
9
|
+
* not resolve to. Other specifiers pass through.
|
|
10
|
+
*/
|
|
5
11
|
export declare function createSdkImportResolver(sdkPath: string, sdkName: string): (specifier: string) => string;
|
|
6
12
|
//# sourceMappingURL=resolve-sdk-import.d.ts.map
|
|
@@ -24,35 +24,31 @@ function readPackageExports(packagePath) {
|
|
|
24
24
|
return {};
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
resolvedSdkPath = fs.realpathSync(sdkPath);
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
// Keep sdkPath as-is if it cannot be canonicalized.
|
|
27
|
+
export function sdkImportsMap(sdkPath, sdkName) {
|
|
28
|
+
const imports = {};
|
|
29
|
+
for (const [subpath, entry] of Object.entries(readPackageExports(sdkPath))) {
|
|
30
|
+
if (subpath.includes('*'))
|
|
31
|
+
continue;
|
|
32
|
+
const target = selectExportTarget(entry);
|
|
33
|
+
if (target === null)
|
|
34
|
+
continue;
|
|
35
|
+
const specifier = subpath === '.' ? sdkName : `${sdkName}/${subpath.slice(2)}`;
|
|
36
|
+
imports[specifier] = pathToFileURL(path.join(sdkPath, target)).href;
|
|
41
37
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
return imports;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Maps `<sdkName>/<subpath>` to the file the SDK at `sdkPath` exports for it,
|
|
42
|
+
* so a worker entry reaches an SDK that the project's own `node_modules` does
|
|
43
|
+
* not resolve to. Other specifiers pass through.
|
|
44
|
+
*/
|
|
45
|
+
export function createSdkImportResolver(sdkPath, sdkName) {
|
|
46
|
+
const prefix = `${sdkName}/`;
|
|
47
|
+
const exports = readPackageExports(sdkPath);
|
|
48
48
|
return (specifier) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const target = selectExportTarget(exports[subpath]);
|
|
54
|
-
return target ? pathToFileURL(path.join(root, target)).href : specifier;
|
|
55
|
-
}
|
|
56
|
-
return specifier;
|
|
49
|
+
if (!specifier.startsWith(prefix))
|
|
50
|
+
return specifier;
|
|
51
|
+
const target = selectExportTarget(exports[`./${specifier.slice(prefix.length)}`]);
|
|
52
|
+
return target ? pathToFileURL(path.join(sdkPath, target)).href : specifier;
|
|
57
53
|
};
|
|
58
54
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The file in each scratch folder that names the process that made it. */
|
|
2
|
+
export declare const SCRATCH_OWNER_FILE = "owner.pid";
|
|
3
|
+
/** A scratch folder `next`, ready to replace `dir`. */
|
|
4
|
+
export interface Staged {
|
|
5
|
+
dir: string;
|
|
6
|
+
next: string;
|
|
7
|
+
/**
|
|
8
|
+
* Set by `replaceAll` when `dir`'s old content could not be moved back: the
|
|
9
|
+
* path in `next`'s scratch folder that still holds it. `discardStaged` keeps
|
|
10
|
+
* that scratch folder.
|
|
11
|
+
*/
|
|
12
|
+
kept?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A new folder with `dir`'s name, inside a folder of its own next to `dir`, so
|
|
16
|
+
* what bare-stow writes there is named as it would be in `dir`. `discardScratch`
|
|
17
|
+
* removes it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function scratchFolderFor(dir: string): Promise<string>;
|
|
20
|
+
export declare function discardScratch(scratch: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Removes the scratch folders `scratchFolderFor(dir)` made in runs that never
|
|
23
|
+
* discarded them, such as a killed one. A folder whose process is still running
|
|
24
|
+
* belongs to a bundle in progress, and one that holds `dir`'s old content may
|
|
25
|
+
* hold the only copy left, so both stay.
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeStaleScratch(dir: string): Promise<void>;
|
|
28
|
+
/** Discards the scratch folder of each staged folder, except one that holds kept content. */
|
|
29
|
+
export declare function discardStaged(staged: Staged[]): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Moves every staged folder into place, or none: when a move fails, the folders
|
|
32
|
+
* already moved go back to their scratch folders and their old content returns.
|
|
33
|
+
*/
|
|
34
|
+
export declare function replaceAll(staged: Staged[]): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=scratch.d.ts.map
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { promises as fsp } from 'node:fs';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/** The file in each scratch folder that names the process that made it. */
|
|
5
|
+
export const SCRATCH_OWNER_FILE = 'owner.pid';
|
|
6
|
+
/**
|
|
7
|
+
* A new folder with `dir`'s name, inside a folder of its own next to `dir`, so
|
|
8
|
+
* what bare-stow writes there is named as it would be in `dir`. `discardScratch`
|
|
9
|
+
* removes it.
|
|
10
|
+
*/
|
|
11
|
+
export async function scratchFolderFor(dir) {
|
|
12
|
+
const owned = path.join(path.dirname(dir), `.${path.basename(dir)}-${randomUUID()}`);
|
|
13
|
+
await fsp.mkdir(owned, { recursive: true });
|
|
14
|
+
await fsp.writeFile(path.join(owned, SCRATCH_OWNER_FILE), String(process.pid));
|
|
15
|
+
return path.join(owned, path.basename(dir));
|
|
16
|
+
}
|
|
17
|
+
export async function discardScratch(scratch) {
|
|
18
|
+
await fsp.rm(path.dirname(scratch), { recursive: true, force: true });
|
|
19
|
+
}
|
|
20
|
+
const UUID = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}';
|
|
21
|
+
/**
|
|
22
|
+
* Removes the scratch folders `scratchFolderFor(dir)` made in runs that never
|
|
23
|
+
* discarded them, such as a killed one. A folder whose process is still running
|
|
24
|
+
* belongs to a bundle in progress, and one that holds `dir`'s old content may
|
|
25
|
+
* hold the only copy left, so both stay.
|
|
26
|
+
*/
|
|
27
|
+
export async function removeStaleScratch(dir) {
|
|
28
|
+
const parent = path.dirname(dir);
|
|
29
|
+
const name = path.basename(dir);
|
|
30
|
+
const pattern = new RegExp(`^\\.${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}-${UUID}$`);
|
|
31
|
+
let entries;
|
|
32
|
+
try {
|
|
33
|
+
entries = await fsp.readdir(parent);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const code = error.code;
|
|
37
|
+
// No scratch folder can exist under a parent that is missing or is a file;
|
|
38
|
+
// making the new scratch folder reports that parent.
|
|
39
|
+
if (code === 'ENOENT' || code === 'ENOTDIR')
|
|
40
|
+
return;
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
if (!pattern.test(entry))
|
|
45
|
+
continue;
|
|
46
|
+
const owned = path.join(parent, entry);
|
|
47
|
+
if (await ownerRunning(owned))
|
|
48
|
+
continue;
|
|
49
|
+
if (await exists(previousOf(path.join(owned, name))))
|
|
50
|
+
continue;
|
|
51
|
+
await fsp.rm(owned, { recursive: true, force: true });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function ownerRunning(owned) {
|
|
55
|
+
let pid;
|
|
56
|
+
try {
|
|
57
|
+
pid = Number.parseInt(await fsp.readFile(path.join(owned, SCRATCH_OWNER_FILE), 'utf8'), 10);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
63
|
+
return false;
|
|
64
|
+
try {
|
|
65
|
+
process.kill(pid, 0);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// EPERM: the process exists but belongs to another user.
|
|
70
|
+
return error.code === 'EPERM';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function exists(file) {
|
|
74
|
+
try {
|
|
75
|
+
await fsp.access(file);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Discards the scratch folder of each staged folder, except one that holds kept content. */
|
|
83
|
+
export async function discardStaged(staged) {
|
|
84
|
+
for (const entry of staged) {
|
|
85
|
+
if (entry.kept === undefined)
|
|
86
|
+
await discardScratch(entry.next);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Moves every staged folder into place, or none: when a move fails, the folders
|
|
91
|
+
* already moved go back to their scratch folders and their old content returns.
|
|
92
|
+
*/
|
|
93
|
+
export async function replaceAll(staged) {
|
|
94
|
+
const replaced = [];
|
|
95
|
+
try {
|
|
96
|
+
for (const entry of staged) {
|
|
97
|
+
await replaceWith(entry);
|
|
98
|
+
replaced.push(entry);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
const failures = [];
|
|
103
|
+
for (const entry of replaced.reverse()) {
|
|
104
|
+
try {
|
|
105
|
+
await putBack(entry, error);
|
|
106
|
+
}
|
|
107
|
+
catch (putBackError) {
|
|
108
|
+
failures.push(putBackError);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (failures.length === 0)
|
|
112
|
+
throw error;
|
|
113
|
+
if (failures.length === 1)
|
|
114
|
+
throw failures[0];
|
|
115
|
+
throw new Error(`Could not put back ${failures.length} folders after a failed replace: ` +
|
|
116
|
+
failures.map(errorMessage).join(' '), { cause: error });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Where `replaceAll` keeps `dir`'s old content: beside `next`, under a name `next` cannot have. */
|
|
120
|
+
function previousOf(next) {
|
|
121
|
+
return `${next}.previous`;
|
|
122
|
+
}
|
|
123
|
+
/** Moves `next` to `dir`, and `dir`'s old content into `next`'s scratch folder. */
|
|
124
|
+
async function replaceWith(entry) {
|
|
125
|
+
const { dir, next } = entry;
|
|
126
|
+
let moved = true;
|
|
127
|
+
try {
|
|
128
|
+
await fsp.rename(dir, previousOf(next));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error.code !== 'ENOENT')
|
|
132
|
+
throw error;
|
|
133
|
+
moved = false;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
await fsp.rename(next, dir);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
if (moved)
|
|
140
|
+
await restorePrevious(entry, error);
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function putBack(entry, cause) {
|
|
145
|
+
try {
|
|
146
|
+
await fsp.rename(entry.dir, entry.next);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
const previous = previousOf(entry.next);
|
|
150
|
+
if (!(await exists(previous)))
|
|
151
|
+
throw error;
|
|
152
|
+
entry.kept = previous;
|
|
153
|
+
throw new Error(`Could not move ${entry.dir} back after a failed replace (${errorMessage(error)}). ` +
|
|
154
|
+
`Its previous content is in ${previous}.`, { cause });
|
|
155
|
+
}
|
|
156
|
+
await restorePrevious(entry, cause);
|
|
157
|
+
}
|
|
158
|
+
function errorMessage(error) {
|
|
159
|
+
return error instanceof Error ? error.message : String(error);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Moves `dir`'s old content back from `next`'s scratch folder. When that fails,
|
|
163
|
+
* marks the entry kept and throws an error naming where the content is.
|
|
164
|
+
*/
|
|
165
|
+
async function restorePrevious(entry, cause) {
|
|
166
|
+
const previous = previousOf(entry.next);
|
|
167
|
+
try {
|
|
168
|
+
await fsp.rename(previous, entry.dir);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
if (error.code === 'ENOENT' && !(await exists(previous)))
|
|
172
|
+
return;
|
|
173
|
+
entry.kept = previous;
|
|
174
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
175
|
+
throw new Error(`Could not replace ${entry.dir} (${reason}), nor move its previous content back ` +
|
|
176
|
+
`(${error instanceof Error ? error.message : String(error)}). The previous content is in ${previous}.`, { cause });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type stow from 'bare-stow';
|
|
2
|
+
export declare const BUNDLE_TARGETS: readonly ["bare-sidecar", "react-native", "pear-runtime", "bare-kit"];
|
|
3
|
+
export type BundleTarget = (typeof BUNDLE_TARGETS)[number];
|
|
4
|
+
export type BundleLanguage = 'javascript' | 'kotlin' | 'python';
|
|
5
|
+
/** The harness file bare-stow writes in a `javascript` harness package. */
|
|
6
|
+
export declare const HARNESS_FILE = "index.js";
|
|
7
|
+
interface TargetSpec {
|
|
8
|
+
load(projectRoot: string): Promise<stow.Target | stow.TargetName>;
|
|
9
|
+
}
|
|
10
|
+
export declare function loadTargetPackage(target: BundleTarget, packageName: string, projectRoot: string): Promise<stow.Target>;
|
|
11
|
+
export declare const TARGETS: Record<BundleTarget, TargetSpec>;
|
|
12
|
+
export declare function isBundleTarget(value: string): value is BundleTarget;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=targets.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { BundleTargetNotInstalledError } from '../../utils/errors-client.js';
|
|
5
|
+
export const BUNDLE_TARGETS = ['bare-sidecar', 'react-native', 'pear-runtime', 'bare-kit'];
|
|
6
|
+
/** The harness file bare-stow writes in a `javascript` harness package. */
|
|
7
|
+
export const HARNESS_FILE = 'index.js';
|
|
8
|
+
export async function loadTargetPackage(target, packageName, projectRoot) {
|
|
9
|
+
for (const from of [path.join(projectRoot, 'package.json'), import.meta.url]) {
|
|
10
|
+
let resolved;
|
|
11
|
+
try {
|
|
12
|
+
resolved = createRequire(from).resolve(packageName);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
return (await import(pathToFileURL(resolved).href)).default;
|
|
18
|
+
}
|
|
19
|
+
throw new BundleTargetNotInstalledError(target, packageName);
|
|
20
|
+
}
|
|
21
|
+
export const TARGETS = {
|
|
22
|
+
'bare-sidecar': {
|
|
23
|
+
load: async () => 'bare-sidecar'
|
|
24
|
+
},
|
|
25
|
+
'react-native': {
|
|
26
|
+
load: (projectRoot) => loadTargetPackage('react-native', 'bare-stow-target-react-native', projectRoot)
|
|
27
|
+
},
|
|
28
|
+
'pear-runtime': {
|
|
29
|
+
load: (projectRoot) => loadTargetPackage('pear-runtime', 'bare-stow-target-pear-runtime', projectRoot)
|
|
30
|
+
},
|
|
31
|
+
'bare-kit': {
|
|
32
|
+
load: async () => 'bare-kit'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export function isBundleTarget(value) {
|
|
36
|
+
return BUNDLE_TARGETS.includes(value);
|
|
37
|
+
}
|
|
@@ -63,12 +63,13 @@ export interface InstallMissingHostPrebuildsOptions {
|
|
|
63
63
|
}
|
|
64
64
|
/** `ensureHostPrebuilds` for addons the caller has already located. */
|
|
65
65
|
export declare function installMissingHostPrebuilds(options: InstallMissingHostPrebuildsOptions): Promise<EnsureHostPrebuildsResult>;
|
|
66
|
+
export declare function findMissingHostPrebuilds(addons: NativeAddon[], hosts: string[]): Promise<HostPrebuildPackage[]>;
|
|
66
67
|
/**
|
|
67
|
-
* The platform packages `addons` still need for
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* The platform packages `addons` still need for `hosts`, one entry per
|
|
69
|
+
* package. Throws when two installed versions of one addon need the same
|
|
70
|
+
* platform package, since only one version of it can be installed.
|
|
70
71
|
*/
|
|
71
|
-
export declare function
|
|
72
|
+
export declare function findMissingPlatformPackages(addons: NativeAddon[], hosts: string[]): Promise<HostPrebuildPackage[]>;
|
|
72
73
|
/**
|
|
73
74
|
* The installed addons named in `names`, or every installed addon when
|
|
74
75
|
* `names` is omitted, split addon metas included. For each name the copy in
|
|
@@ -69,18 +69,20 @@ export async function installMissingHostPrebuilds(options) {
|
|
|
69
69
|
logger.info(` Installed ${missing.length} platform package${missing.length === 1 ? '' : 's'}`);
|
|
70
70
|
return { installed: missing, packageManager: manager };
|
|
71
71
|
}
|
|
72
|
+
export async function findMissingHostPrebuilds(addons, hosts) {
|
|
73
|
+
return findMissingPlatformPackages(addons, hosts.filter(isMobileHost));
|
|
74
|
+
}
|
|
72
75
|
/**
|
|
73
|
-
* The platform packages `addons` still need for
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
+
* The platform packages `addons` still need for `hosts`, one entry per
|
|
77
|
+
* package. Throws when two installed versions of one addon need the same
|
|
78
|
+
* platform package, since only one version of it can be installed.
|
|
76
79
|
*/
|
|
77
|
-
export async function
|
|
78
|
-
const mobileHosts = hosts.filter(isMobileHost);
|
|
80
|
+
export async function findMissingPlatformPackages(addons, hosts) {
|
|
79
81
|
const packages = new Map();
|
|
80
|
-
if (
|
|
82
|
+
if (hosts.length === 0)
|
|
81
83
|
return [];
|
|
82
84
|
for (const addon of addons) {
|
|
83
|
-
for (const issue of await checkPrebuilds({ addon, hosts
|
|
85
|
+
for (const issue of await checkPrebuilds({ addon, hosts })) {
|
|
84
86
|
const pin = issue.platformPackage;
|
|
85
87
|
if (pin === undefined)
|
|
86
88
|
continue;
|
|
@@ -3,12 +3,13 @@ export type { BundleSdkOptions, BundleSdkResult } from '../commands/bundle/index
|
|
|
3
3
|
export { ensureHostPrebuilds } from '../commands/host-prebuilds/index.js';
|
|
4
4
|
export type { EnsureHostPrebuildsOptions, EnsureHostPrebuildsResult, HostPrebuildPackage, PackageManagerName } from '../commands/host-prebuilds/index.js';
|
|
5
5
|
export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from '../commands/verify/index.js';
|
|
6
|
-
export type { VerifyBundleOptions, VerifyBundleResult, VerifyBundleIssue,
|
|
6
|
+
export type { VerifyBundleOptions, VerifyBundleResult, VerifyBundleIssue, PlatformRuntime } from '../commands/verify/index.js';
|
|
7
7
|
export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError, HostPrebuildsMissingError } from '../utils/errors-client.js';
|
|
8
8
|
export { formatRuntimeSource } from '../commands/verify/abi.js';
|
|
9
|
-
export type { BareRuntime, BareRuntimeResolution } from '../commands/verify/abi.js';
|
|
9
|
+
export type { BareKitBinding, BareRuntime, BareRuntimeResolution } from '../commands/verify/abi.js';
|
|
10
10
|
export { isReactNativeBareKitInstalled } from '../commands/verify/bare-kit-runtime.js';
|
|
11
|
+
export type { BareKitPlatform } from '../commands/verify/bare-kit-runtime.js';
|
|
11
12
|
export { isMobileHost } from '../commands/verify/prebuilds.js';
|
|
12
13
|
export { formatEnginesAdvice } from '../commands/verify/engines-advice.js';
|
|
13
|
-
export type { EnginesAdvice, EnginesOverride
|
|
14
|
+
export type { EnginesAdvice, EnginesOverride } from '../commands/verify/engines-advice.js';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|