@qvac/sdk 0.21.1 → 0.22.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 +84 -55
- package/README.md +167 -24
- package/dist/examples/abot-world.js +1 -1
- package/dist/examples/advisory-model-fit.d.ts +0 -58
- package/dist/examples/advisory-model-fit.js +23 -150
- package/dist/examples/asr/moss-transcribe-filesystem.d.ts +2 -0
- package/dist/examples/asr/moss-transcribe-filesystem.js +84 -0
- package/dist/examples/asr/moss-transcribe-fit.d.ts +2 -0
- package/dist/examples/asr/moss-transcribe-fit.js +40 -0
- package/dist/examples/asr/nemotron-diarization-filesystem.d.ts +2 -0
- package/dist/examples/asr/nemotron-diarization-filesystem.js +64 -0
- package/dist/examples/asr/parakeet-ctc-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-indic-conformer-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-microphone-record.js +1 -1
- package/dist/examples/asr/parakeet-microphone-stream.js +1 -1
- package/dist/examples/asr/parakeet-nemotron-filesystem.js +3 -3
- package/dist/examples/asr/parakeet-sortformer-streaming.js +2 -2
- package/dist/examples/asr/parakeet-sortformer.js +1 -1
- package/dist/examples/asr/parakeet-tdt-filesystem-chunked.js +2 -2
- package/dist/examples/asr/parakeet-tdt-filesystem.js +2 -2
- package/dist/examples/asr/parakeet-unified-coreml.js +2 -2
- package/dist/examples/asr/parakeet-unified-filesystem.js +2 -2
- package/dist/examples/asr/whispercpp-filesystem-streaming.js +1 -1
- package/dist/examples/asr/whispercpp-filesystem.js +1 -1
- package/dist/examples/asr/whispercpp-microphone-record.js +1 -1
- package/dist/examples/asr/whispercpp-prompt.js +1 -1
- package/dist/examples/assess-model-fit.js +3 -6
- package/dist/examples/audiogen/edit-music.js +2 -2
- package/dist/examples/audiogen/generate-cover.js +2 -2
- package/dist/examples/audiogen/generate-music-minimax.js +1 -1
- package/dist/examples/audiogen/generate-music.js +1 -1
- package/dist/examples/audiogen/understand-music.js +2 -2
- package/dist/examples/batch-completion.d.ts +1 -1
- package/dist/examples/batch-completion.js +1 -1
- package/dist/examples/bci/bci-filesystem-streaming.js +2 -2
- package/dist/examples/bci/bci-filesystem.js +2 -2
- package/dist/examples/concurrent-completion-collision.js +1 -1
- package/dist/examples/config-reload.js +1 -1
- package/dist/examples/decisions.d.ts +2 -0
- package/dist/examples/decisions.js +38 -0
- package/dist/examples/diffusion-esrgan-upscale.js +1 -1
- package/dist/examples/diffusion-flux2-klein-img2img.js +1 -1
- package/dist/examples/diffusion-img2img.js +1 -1
- package/dist/examples/diffusion-img2vid-ltx.js +1 -1
- package/dist/examples/diffusion-img2vid-minimax-h3.d.ts +2 -0
- package/dist/examples/diffusion-img2vid-minimax-h3.js +72 -0
- package/dist/examples/diffusion-img2vid.js +1 -1
- package/dist/examples/llamacpp-filesystem.js +1 -1
- package/dist/examples/llamacpp-multi-gpu.js +2 -2
- package/dist/examples/llamacpp-structured-output.js +1 -1
- package/dist/examples/mcp-websearch.d.ts +2 -2
- package/dist/examples/mcp-websearch.js +3 -3
- package/dist/examples/model-fit-ui/server.d.ts +1 -1
- package/dist/examples/model-fit-ui/server.js +1 -1
- package/dist/examples/multi-job-completion.d.ts +1 -1
- package/dist/examples/multi-job-completion.js +1 -1
- package/dist/examples/ocr-fasttext.js +1 -1
- package/dist/examples/tools/llamacpp-tools-auto-dialect.js +1 -1
- package/dist/examples/tools/llamacpp-tools-gemma4.js +1 -1
- package/dist/examples/tools/llamacpp-tools-qwen35.js +1 -1
- package/dist/examples/tts/llm-to-tts-streaming.d.ts +2 -2
- package/dist/examples/tts/llm-to-tts-streaming.js +2 -2
- package/dist/examples/tts/moss-sound-effect-controls.d.ts +2 -0
- package/dist/examples/tts/moss-sound-effect-controls.js +88 -0
- package/dist/examples/tts/moss-sound-effect.d.ts +2 -0
- package/dist/examples/tts/moss-sound-effect.js +86 -0
- package/dist/examples/tts/moss-speech-audio.d.ts +2 -0
- package/dist/examples/tts/moss-speech-audio.js +159 -0
- package/dist/examples/tts/moss-speech.d.ts +2 -0
- package/dist/examples/tts/moss-speech.js +70 -0
- package/dist/examples/vla-groot.js +2 -2
- package/dist/examples/vla-pi05.js +2 -2
- package/dist/examples/vla-smolvla.js +2 -2
- package/dist/examples/voice-assistant/voice-assistant.js +1 -1
- package/dist/scripts/contract/build-contract.d.ts +3 -1
- package/dist/scripts/contract/build-contract.js +40 -2
- package/dist/scripts/contract/build-model-type-maps.d.ts +6 -1
- package/dist/scripts/contract/build-model-type-maps.js +3 -2
- package/dist/scripts/contract/constants-registry.d.ts +4 -0
- package/dist/scripts/contract/constants-registry.js +3 -1
- package/dist/scripts/contract/method-shapes.d.ts +1 -0
- package/dist/scripts/contract/method-shapes.js +1 -0
- package/dist/scripts/export-contract.js +20 -7
- package/dist/scripts/run-unit-tests.js +10 -5
- package/dist/src/client/api/assess-model-fit.d.ts +5 -5
- package/dist/src/client/api/assess-model-fit.js +5 -6
- package/dist/src/client/api/audio-edit.d.ts +14 -2
- package/dist/src/client/api/audio-edit.js +14 -2
- package/dist/src/client/api/audio-gen.d.ts +10 -2
- package/dist/src/client/api/audio-gen.js +10 -2
- package/dist/src/client/api/audio-understand.d.ts +1 -1
- package/dist/src/client/api/audio-understand.js +1 -1
- package/dist/src/client/api/batch-completion.js +1 -1
- package/dist/src/client/api/completion-stream.js +1 -1
- package/dist/src/client/api/decide.d.ts +31 -0
- package/dist/src/client/api/decide.js +29 -0
- package/dist/src/client/api/index.d.ts +1 -0
- package/dist/src/client/api/index.js +1 -0
- package/dist/src/client/api/load-model.d.ts +1 -0
- package/dist/src/client/api/text-to-speech.d.ts +1 -0
- package/dist/src/client/api/text-to-speech.js +15 -22
- package/dist/src/client/api/transcribe.js +5 -2
- package/dist/src/client/api/video-request.d.ts +5 -5
- package/dist/src/client/api/video.d.ts +23 -3
- package/dist/src/client/api/video.js +23 -3
- package/dist/src/commands/bundle/bare-pack.d.ts +8 -0
- package/dist/src/commands/bundle/bare-pack.js +28 -5
- package/dist/src/commands/bundle/constants.js +2 -0
- package/dist/src/commands/bundle/index.d.ts +7 -6
- package/dist/src/commands/bundle/index.js +126 -43
- package/dist/src/commands/bundle/manifest.d.ts +2 -0
- package/dist/src/commands/bundle/manifest.js +3 -2
- package/dist/src/commands/host-prebuilds/index.d.ts +15 -7
- package/dist/src/commands/host-prebuilds/index.js +35 -16
- package/dist/src/commands/index.d.ts +1 -1
- package/dist/src/commands/index.js +1 -1
- package/dist/src/commands/verify/addon-source.d.ts +12 -0
- package/dist/src/commands/verify/addon-source.js +36 -3
- package/dist/src/commands/verify/bare-kit-runtimes.js +2 -1
- package/dist/src/commands/verify/node-modules-source.js +10 -1
- package/dist/src/{expo/plugins/patches/qvac-platform-addons.d.ts → commands/verify/platform-addons.d.ts} +6 -10
- package/dist/src/{expo/plugins/patches/qvac-platform-addons.js → commands/verify/platform-addons.js} +2 -45
- package/dist/src/commands/verify/prebuilds.d.ts +7 -10
- package/dist/src/commands/verify/prebuilds.js +43 -34
- package/dist/src/expo/plugins/get-project-root.d.ts +1 -1
- package/dist/src/expo/plugins/link-addons.d.ts +18 -0
- package/dist/src/expo/plugins/link-addons.js +65 -0
- package/dist/src/expo/plugins/withAndroidArchitecture.d.ts +1 -1
- package/dist/src/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
- package/dist/src/expo/plugins/withDeviceInfo.d.ts +1 -1
- package/dist/src/expo/plugins/withMobileBundle.d.ts +11 -21
- package/dist/src/expo/plugins/withMobileBundle.js +22 -112
- package/dist/src/expo/plugins/withOpenCL.d.ts +1 -1
- package/dist/src/expo/plugins/withQvacSDK.d.ts +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +2 -2
- package/dist/src/logging/base-logger.js +1 -1
- package/dist/src/logging/utils.js +1 -1
- package/dist/src/pear/pre.js +2 -0
- package/dist/src/plugin-ids.d.ts +3 -1
- package/dist/src/plugin-ids.js +4 -0
- package/dist/src/schemas/public.d.ts +2 -1
- package/dist/src/schemas/public.js +2 -1
- package/dist/src/schemas/sdk-errors-client.d.ts +3 -0
- package/dist/src/schemas/sdk-errors-client.js +16 -0
- package/dist/src/schemas/sdk-errors-server.d.ts +1 -0
- package/dist/src/schemas/sdk-errors-server.js +5 -0
- package/dist/src/utils/errors-client.d.ts +10 -0
- package/dist/src/utils/errors-client.js +18 -0
- package/dist/src/utils/mcp-adapter.js +12 -8
- package/dist/src/utils/tool-helpers.d.ts +1 -1
- package/dist/src/utils/tool-helpers.js +20 -52
- package/dist/src/worker/create-server.d.ts +1 -0
- package/dist/src/worker/create-server.js +5 -0
- package/dist/src/worker/index.js +4 -0
- package/dist/src/worker/lifecycle.js +9 -1
- package/dist/src/worker/plugins/llamacpp-decision.d.ts +2 -0
- package/dist/src/worker/plugins/llamacpp-decision.js +1 -0
- package/dist/src/worker/plugins/moss-transcribe.d.ts +2 -0
- package/dist/src/worker/plugins/moss-transcribe.js +1 -0
- package/package.json +39 -35
- package/src/electron-forge/index.cjs +12 -71
- package/dist/scripts/link-workspace-inference.d.ts +0 -2
- package/dist/scripts/link-workspace-inference.js +0 -31
- package/src/expo/plugins/patches/android-link.mjs +0 -67
- package/src/expo/plugins/patches/ios-link.mjs +0 -67
- package/src/expo/plugins/patches/qvac-platform-addons.ts +0 -124
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Logger } from '../../logging/types.js';
|
|
2
|
+
export declare const BARE_PACK_NODE_ENGINES = "^22.21.0 || >=24.9.0";
|
|
3
|
+
export declare function isBarePackNodeSupported(version: string): boolean;
|
|
4
|
+
interface NodeVersions {
|
|
5
|
+
node: string;
|
|
6
|
+
bun?: string | undefined;
|
|
7
|
+
}
|
|
2
8
|
interface RunBarePackOptions {
|
|
3
9
|
entryPath: string;
|
|
4
10
|
outputPath: string;
|
|
@@ -7,6 +13,8 @@ interface RunBarePackOptions {
|
|
|
7
13
|
deferModules: string[];
|
|
8
14
|
quiet: boolean;
|
|
9
15
|
logger: Logger;
|
|
16
|
+
/** The runtime running bare-pack; defaults to this process. Tests inject an older Node. */
|
|
17
|
+
nodeVersions?: NodeVersions | undefined;
|
|
10
18
|
}
|
|
11
19
|
export declare function runBarePack(options: RunBarePackOptions): Promise<void>;
|
|
12
20
|
export {};
|
|
@@ -2,9 +2,29 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
|
-
import { platform, execPath } from 'node:process';
|
|
6
|
-
import
|
|
5
|
+
import { platform, execPath, versions } from 'node:process';
|
|
6
|
+
import semver from 'semver';
|
|
7
|
+
import { BarePackNotInstalledError, BarePackNodeUnsupportedError, BarePackError } from '../../utils/errors-client.js';
|
|
7
8
|
const require = createRequire(import.meta.url);
|
|
9
|
+
// bare-module-lexer (loaded by bare-pack through bare-module-traverse) calls
|
|
10
|
+
// js_is_sharedarraybuffer from its native addon, which Node outside this range
|
|
11
|
+
// lacks; the bare-pack child process crashes instead of throwing. Same range as
|
|
12
|
+
// engines.node in @qvac/cli.
|
|
13
|
+
export const BARE_PACK_NODE_ENGINES = '^22.21.0 || >=24.9.0';
|
|
14
|
+
export function isBarePackNodeSupported(version) {
|
|
15
|
+
return semver.satisfies(version, BARE_PACK_NODE_ENGINES, { includePrerelease: true });
|
|
16
|
+
}
|
|
17
|
+
// On Node, bare-pack is spawned with this process's execPath, so checking
|
|
18
|
+
// process.versions.node checks the Node that will load the lexer. Under Bun,
|
|
19
|
+
// process.versions.node is Bun's emulated value and, except on Windows, bare-pack
|
|
20
|
+
// runs through its shebang in the `node` from PATH, which cannot be checked here.
|
|
21
|
+
function assertNodeCanRunBarePack(nodeVersions) {
|
|
22
|
+
if (nodeVersions.bun !== undefined)
|
|
23
|
+
return;
|
|
24
|
+
if (isBarePackNodeSupported(nodeVersions.node))
|
|
25
|
+
return;
|
|
26
|
+
throw new BarePackNodeUnsupportedError(nodeVersions.node, BARE_PACK_NODE_ENGINES);
|
|
27
|
+
}
|
|
8
28
|
function resolveBarePackBin() {
|
|
9
29
|
try {
|
|
10
30
|
const barePackPkgPath = require.resolve('bare-pack/package');
|
|
@@ -17,10 +37,12 @@ function resolveBarePackBin() {
|
|
|
17
37
|
}
|
|
18
38
|
export async function runBarePack(options) {
|
|
19
39
|
const { entryPath, outputPath, hosts, importsMapPath, deferModules, quiet, logger } = options;
|
|
40
|
+
const nodeVersions = options.nodeVersions ?? versions;
|
|
20
41
|
const barePackBin = resolveBarePackBin();
|
|
21
42
|
if (!barePackBin || !fs.existsSync(barePackBin)) {
|
|
22
43
|
throw new BarePackNotInstalledError();
|
|
23
44
|
}
|
|
45
|
+
assertNodeCanRunBarePack(nodeVersions);
|
|
24
46
|
return new Promise((resolve, reject) => {
|
|
25
47
|
const hostArgs = hosts.flatMap((h) => ['--host', h]);
|
|
26
48
|
const deferArgs = deferModules.flatMap((m) => ['--defer', m]);
|
|
@@ -34,9 +56,10 @@ export async function runBarePack(options) {
|
|
|
34
56
|
outputPath,
|
|
35
57
|
entryPath
|
|
36
58
|
];
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
59
|
+
// Windows cannot exec a .js file directly, so it always goes through execPath.
|
|
60
|
+
const viaShebang = nodeVersions.bun !== undefined && platform !== 'win32';
|
|
61
|
+
const command = viaShebang ? barePackBin : execPath;
|
|
62
|
+
const spawnArgs = viaShebang ? args : [barePackBin, ...args];
|
|
40
63
|
logger.debug(`\n📦 Running: ${command} ${spawnArgs.join(' ')}`);
|
|
41
64
|
const proc = spawn(command, spawnArgs, {
|
|
42
65
|
stdio: quiet ? 'ignore' : 'inherit'
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export const BUILTIN_PLUGINS = {
|
|
2
2
|
'llamacpp-completion': { exportName: 'llmPlugin' },
|
|
3
3
|
'llamacpp-embedding': { exportName: 'embeddingsPlugin' },
|
|
4
|
+
'llamacpp-decision': { exportName: 'decisionPlugin' },
|
|
4
5
|
'whispercpp-transcription': { exportName: 'whisperPlugin' },
|
|
5
6
|
'bci-whispercpp-transcription': { exportName: 'bciPlugin' },
|
|
6
7
|
'parakeet-transcription': { exportName: 'parakeetPlugin' },
|
|
8
|
+
'moss-transcribe': { exportName: 'mossTranscribePlugin' },
|
|
7
9
|
'nmtcpp-translation': { exportName: 'nmtPlugin' },
|
|
8
10
|
'tts-ggml': { exportName: 'ttsPlugin' },
|
|
9
11
|
'ggml-ocr': { exportName: 'ocrPlugin' },
|
|
@@ -8,12 +8,13 @@ export interface BundleSdkOptions {
|
|
|
8
8
|
quiet?: boolean | undefined;
|
|
9
9
|
verbose?: boolean | undefined;
|
|
10
10
|
/**
|
|
11
|
-
* Install the addon platform packages the
|
|
12
|
-
* with the project's package manager
|
|
13
|
-
*
|
|
14
|
-
* package.json or node_modules
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* Install the addon platform packages that the split addons the bundle
|
|
12
|
+
* reaches need for its mobile hosts, with the project's package manager
|
|
13
|
+
* (see `ensureHostPrebuilds`), before bundling. Off by default: without it,
|
|
14
|
+
* bundling never changes package.json or node_modules, and a mobile host
|
|
15
|
+
* whose platform package is missing fails with `HostPrebuildsMissingError`,
|
|
16
|
+
* naming the exact pins. A refused install
|
|
17
|
+
* throws `HostPrebuildsInstallRefusedError` before anything is written.
|
|
17
18
|
*/
|
|
18
19
|
installMissingPrebuilds?: boolean | undefined;
|
|
19
20
|
/**
|
|
@@ -4,14 +4,13 @@ import { createRequire } from 'node:module';
|
|
|
4
4
|
import { DEFAULT_HOSTS, DEFAULT_SDK_NAME } from './constants.js';
|
|
5
5
|
import { CONFIG_CANDIDATES, resolveConfigForProject } from '../../client/config-loader/resolve-config.node.js';
|
|
6
6
|
import { createCommandLogger } from '../command-logger.js';
|
|
7
|
-
import { BareImportsMapNotFoundError,
|
|
7
|
+
import { BareImportsMapNotFoundError, HostPrebuildsMissingError } from '../../utils/errors-client.js';
|
|
8
8
|
import { resolvePluginSpecifiers, parseBuiltinSpecifier } from './plugins.js';
|
|
9
9
|
import { generateWorkerEntries } from './entry-gen.js';
|
|
10
10
|
import { runBarePack } from './bare-pack.js';
|
|
11
|
-
import { generateAddonsManifest } from './manifest.js';
|
|
11
|
+
import { AUDIO_DECODER_ADDON, extractBarePackHeader, extractPackedString, generateAddonsManifest } from './manifest.js';
|
|
12
12
|
import { createSdkImportResolver } from './resolve-sdk-import.js';
|
|
13
|
-
import { installMissingHostPrebuilds } from '../host-prebuilds/index.js';
|
|
14
|
-
import { collectAddonsFromBundle } from '../verify/bundle-source.js';
|
|
13
|
+
import { findMissingHostPrebuilds, installMissingHostPrebuilds, resolveAddons } from '../host-prebuilds/index.js';
|
|
15
14
|
import { verifyBundle } from '../verify/index.js';
|
|
16
15
|
import { formatRuntimeSource } from '../verify/abi.js';
|
|
17
16
|
import { formatEnginesAdvice } from '../verify/engines-advice.js';
|
|
@@ -55,6 +54,19 @@ function resolveImportsMapPath(sdkPath, sdkName) {
|
|
|
55
54
|
throw new BareImportsMapNotFoundError(sdkName, importsMapPath);
|
|
56
55
|
}
|
|
57
56
|
const ENGINES_ISSUE_CODES = new Set(['abi-mismatch', 'engines-mismatch']);
|
|
57
|
+
const AUDIO_PLUGINS = new Set([
|
|
58
|
+
'whispercpp-transcription',
|
|
59
|
+
'bci-whispercpp-transcription',
|
|
60
|
+
'parakeet-transcription',
|
|
61
|
+
'moss-transcribe',
|
|
62
|
+
'audiogen-ggml'
|
|
63
|
+
]);
|
|
64
|
+
function audioPluginsIn(pluginSpecifiers, sdkName) {
|
|
65
|
+
return pluginSpecifiers.filter((specifier) => {
|
|
66
|
+
const builtin = parseBuiltinSpecifier(specifier, sdkName);
|
|
67
|
+
return builtin !== null && AUDIO_PLUGINS.has(builtin.suffix);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
58
70
|
async function checkBundleEngines(options) {
|
|
59
71
|
const { projectRoot, bundlePath, hosts, configPath, network, logger } = options;
|
|
60
72
|
logger.info('\n🔎 Checking engines.bare against the Bare runtime of each host...');
|
|
@@ -124,7 +136,17 @@ export async function bundleSdk(options = {}) {
|
|
|
124
136
|
logger.info(` ${label}: ${spec}`);
|
|
125
137
|
}
|
|
126
138
|
const hosts = options.hosts && options.hosts.length > 0 ? options.hosts : DEFAULT_HOSTS;
|
|
127
|
-
const
|
|
139
|
+
const explicitDefer = options.defer ?? [];
|
|
140
|
+
const includeAudioDecoder = config.includeAudioDecoder !== false && !explicitDefer.includes(AUDIO_DECODER_ADDON);
|
|
141
|
+
const deferModules = includeAudioDecoder
|
|
142
|
+
? explicitDefer
|
|
143
|
+
: [...new Set([...explicitDefer, AUDIO_DECODER_ADDON])];
|
|
144
|
+
if (!includeAudioDecoder) {
|
|
145
|
+
const affected = audioPluginsIn(pluginSpecifiers, sdkName);
|
|
146
|
+
if (affected.length > 0) {
|
|
147
|
+
logger.warn(`${AUDIO_DECODER_ADDON} is not bundled: ${affected.join(', ')} cannot decode compressed audio files; compressed audiogen output formats also require FFmpeg.`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
128
150
|
await fsp.mkdir(outputDir, { recursive: true });
|
|
129
151
|
logger.info('\n📝 Generating worker entry...');
|
|
130
152
|
const resolveSdkImport = createSdkImportResolver(sdkPath, sdkName);
|
|
@@ -137,46 +159,44 @@ export async function bundleSdk(options = {}) {
|
|
|
137
159
|
if (deferModules.length > 0) {
|
|
138
160
|
logger.debug(` Deferred: ${deferModules.join(', ')}`);
|
|
139
161
|
}
|
|
162
|
+
// Missing mobile platform packages are installed, or reported, before bundling.
|
|
140
163
|
let installedPrebuilds = [];
|
|
141
|
-
|
|
164
|
+
const barePackOptions = {
|
|
165
|
+
entryPath: bundleEntryPath,
|
|
166
|
+
hosts,
|
|
167
|
+
importsMapPath,
|
|
168
|
+
quiet: options.quiet === true,
|
|
169
|
+
logger
|
|
170
|
+
};
|
|
171
|
+
const addonsMissingPlatformPackages = () => reachedAddonsMissingPlatformPackages({
|
|
172
|
+
addons: async () => (await resolveAddons(projectRoot, undefined, logger)).filter((addon) => !deferModules.includes(addon.name)),
|
|
173
|
+
hosts,
|
|
174
|
+
scan: (extraDefer, outputPath) => runBarePack({
|
|
175
|
+
...barePackOptions,
|
|
176
|
+
outputPath,
|
|
177
|
+
deferModules: [...deferModules, ...extraDefer],
|
|
178
|
+
quiet: true
|
|
179
|
+
}),
|
|
180
|
+
scanPath: path.join(outputDir, 'worker.scan.bundle.js'),
|
|
181
|
+
logger
|
|
182
|
+
});
|
|
142
183
|
try {
|
|
143
184
|
await fsp.writeFile(bundleEntryPath, bundleEntry, 'utf8');
|
|
144
|
-
const
|
|
145
|
-
entryPath: bundleEntryPath,
|
|
146
|
-
outputPath: bundlePath,
|
|
147
|
-
hosts,
|
|
148
|
-
importsMapPath,
|
|
149
|
-
deferModules,
|
|
150
|
-
quiet: options.quiet === true,
|
|
151
|
-
logger
|
|
152
|
-
};
|
|
153
|
-
await runBarePack(barePackOptions);
|
|
185
|
+
const addons = await addonsMissingPlatformPackages();
|
|
154
186
|
if (options.installMissingPrebuilds === true) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
installedPrebuilds = installed;
|
|
164
|
-
// Where a platform package was missing, bare-pack resolved the addon's
|
|
165
|
-
// `#host-addon` import to its fallback module; bundle again to pick up
|
|
166
|
-
// the installed package.
|
|
167
|
-
if (installed.length > 0) {
|
|
168
|
-
logger.info('\n🔨 Bundling again with the installed platform packages...');
|
|
169
|
-
await runBarePack(barePackOptions);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
if (!(error instanceof HostPrebuildsInstallRefusedError))
|
|
174
|
-
throw error;
|
|
175
|
-
// A refusal happens before anything is installed, so the bundle
|
|
176
|
-
// already written is final and only its manifest is left to write.
|
|
177
|
-
installRefused = error;
|
|
178
|
-
}
|
|
187
|
+
const { installed } = await installMissingHostPrebuilds({
|
|
188
|
+
projectRoot,
|
|
189
|
+
hosts,
|
|
190
|
+
addons,
|
|
191
|
+
quiet: options.quiet === true,
|
|
192
|
+
logger
|
|
193
|
+
});
|
|
194
|
+
installedPrebuilds = installed;
|
|
179
195
|
}
|
|
196
|
+
else {
|
|
197
|
+
await throwIfPlatformPackagesMissing(addons, hosts);
|
|
198
|
+
}
|
|
199
|
+
await runBarePack({ ...barePackOptions, outputPath: bundlePath, deferModules });
|
|
180
200
|
}
|
|
181
201
|
finally {
|
|
182
202
|
await fsp.rm(bundleEntryPath, { force: true });
|
|
@@ -189,7 +209,8 @@ export async function bundleSdk(options = {}) {
|
|
|
189
209
|
bundlePath,
|
|
190
210
|
outputDir,
|
|
191
211
|
projectRoot,
|
|
192
|
-
logger
|
|
212
|
+
logger,
|
|
213
|
+
includeAudioDecoder
|
|
193
214
|
});
|
|
194
215
|
if (options.checkEngines !== false) {
|
|
195
216
|
await checkBundleEngines({
|
|
@@ -201,8 +222,6 @@ export async function bundleSdk(options = {}) {
|
|
|
201
222
|
logger
|
|
202
223
|
});
|
|
203
224
|
}
|
|
204
|
-
if (installRefused !== undefined)
|
|
205
|
-
throw installRefused;
|
|
206
225
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
207
226
|
logger.info(`\n🎉 Done in ${elapsed}s!\n`);
|
|
208
227
|
logger.info('Generated files:');
|
|
@@ -222,3 +241,67 @@ export async function bundleSdk(options = {}) {
|
|
|
222
241
|
installedPrebuilds
|
|
223
242
|
};
|
|
224
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* The installed split addons that the bundle reaches and that are missing a
|
|
246
|
+
* mobile platform package. Every installed addon is a candidate (`@qvac/sdk`
|
|
247
|
+
* depends on all of them), so a first bare-pack pass defers each missing
|
|
248
|
+
* platform package: bare-pack then records the reached ones as
|
|
249
|
+
* `deferred:<package>` and never visits the rest. Empty when nothing is
|
|
250
|
+
* missing, or when that pass fails, which leaves the real bundle to report
|
|
251
|
+
* the failure.
|
|
252
|
+
*/
|
|
253
|
+
async function reachedAddonsMissingPlatformPackages(options) {
|
|
254
|
+
const { hosts, scan, scanPath, logger } = options;
|
|
255
|
+
const addons = await options.addons();
|
|
256
|
+
const missing = await findMissingHostPrebuilds(addons, hosts);
|
|
257
|
+
if (missing.length === 0)
|
|
258
|
+
return [];
|
|
259
|
+
logger.debug(`\n🔎 Checking which of ${missing.length} missing platform packages the bundle reaches...`);
|
|
260
|
+
try {
|
|
261
|
+
await scan(missing.map((pkg) => pkg.name), scanPath);
|
|
262
|
+
const reached = deferredSpecifiers(await fsp.readFile(scanPath, 'utf8'));
|
|
263
|
+
const owners = new Set(missing.filter((pkg) => reached.has(pkg.name)).map((pkg) => pkg.addon));
|
|
264
|
+
return addons.filter((addon) => owners.has(addon.name));
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
logger.debug(` Scan failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
268
|
+
return [];
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
await fsp.rm(scanPath, { force: true });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const DEFERRED_PROTOCOL = 'deferred:';
|
|
275
|
+
/** Every specifier a bare-pack bundle leaves as `deferred:<specifier>`. */
|
|
276
|
+
function deferredSpecifiers(bundleText) {
|
|
277
|
+
const { resolutions = {} } = extractBarePackHeader(extractPackedString(bundleText));
|
|
278
|
+
const found = new Set();
|
|
279
|
+
const visit = (value) => {
|
|
280
|
+
if (typeof value === 'string') {
|
|
281
|
+
if (value.startsWith(DEFERRED_PROTOCOL))
|
|
282
|
+
found.add(value.slice(DEFERRED_PROTOCOL.length));
|
|
283
|
+
}
|
|
284
|
+
else if (value !== null && typeof value === 'object') {
|
|
285
|
+
for (const nested of Object.values(value))
|
|
286
|
+
visit(nested);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
visit(resolutions);
|
|
290
|
+
return found;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Throws `HostPrebuildsMissingError` when split addons are missing mobile
|
|
294
|
+
* platform packages, naming the exact pins.
|
|
295
|
+
*/
|
|
296
|
+
async function throwIfPlatformPackagesMissing(addons, hosts) {
|
|
297
|
+
let missing;
|
|
298
|
+
try {
|
|
299
|
+
missing = await findMissingHostPrebuilds(addons, hosts);
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (missing.length === 0)
|
|
305
|
+
return;
|
|
306
|
+
throw new HostPrebuildsMissingError(Object.fromEntries(missing.map((pkg) => [pkg.name, pkg.version])));
|
|
307
|
+
}
|
|
@@ -10,7 +10,9 @@ interface GenerateAddonsManifestOptions {
|
|
|
10
10
|
outputDir: string;
|
|
11
11
|
projectRoot: string;
|
|
12
12
|
logger: Logger;
|
|
13
|
+
includeAudioDecoder?: boolean;
|
|
13
14
|
}
|
|
15
|
+
export declare const AUDIO_DECODER_ADDON = "bare-ffmpeg";
|
|
14
16
|
interface GenerateAddonsManifestResult {
|
|
15
17
|
manifestPath: string;
|
|
16
18
|
addons: string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs, { promises as fsp } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
export const AUDIO_DECODER_ADDON = 'bare-ffmpeg';
|
|
3
4
|
export function extractPackedString(bundleJsText) {
|
|
4
5
|
const idx = bundleJsText.indexOf('module.exports');
|
|
5
6
|
if (idx === -1) {
|
|
@@ -150,7 +151,7 @@ export function buildNestedPathIndex(resolutions, projectRoot) {
|
|
|
150
151
|
return index;
|
|
151
152
|
}
|
|
152
153
|
export async function generateAddonsManifest(options) {
|
|
153
|
-
const { bundlePath, outputDir, projectRoot, logger } = options;
|
|
154
|
+
const { bundlePath, outputDir, projectRoot, logger, includeAudioDecoder = true } = options;
|
|
154
155
|
logger.info('\n📦 Generating addons manifest...');
|
|
155
156
|
const bundleJsText = await fsp.readFile(bundlePath, 'utf8');
|
|
156
157
|
const packed = extractPackedString(bundleJsText);
|
|
@@ -171,7 +172,7 @@ export async function generateAddonsManifest(options) {
|
|
|
171
172
|
logger.warn(` Could not read ${candidate}: ${err.message}`);
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
|
-
if (pkgJson?.addon === true) {
|
|
175
|
+
if (pkgJson?.addon === true && (includeAudioDecoder || pkgName !== AUDIO_DECODER_ADDON)) {
|
|
175
176
|
addons.push(pkgName);
|
|
176
177
|
}
|
|
177
178
|
}
|
|
@@ -9,7 +9,8 @@ export interface EnsureHostPrebuildsOptions {
|
|
|
9
9
|
hosts: string[];
|
|
10
10
|
/**
|
|
11
11
|
* Addon package names to cover. Defaults to every addon installed for the
|
|
12
|
-
* project: in its own node_modules or in that
|
|
12
|
+
* project, split addon metas included: in its own node_modules or in that
|
|
13
|
+
* of a workspace root listing it.
|
|
13
14
|
*/
|
|
14
15
|
addons?: string[] | undefined;
|
|
15
16
|
/** Install with this package manager instead of detecting the project's own. */
|
|
@@ -38,15 +39,15 @@ export interface EnsureHostPrebuildsResult {
|
|
|
38
39
|
* hosts and that the project does not have yet.
|
|
39
40
|
*
|
|
40
41
|
* A split addon names one platform package per host in the `#host-addon` map
|
|
41
|
-
* of its package.json (`<addon>-ios` covers every iOS host)
|
|
42
|
-
*
|
|
43
|
-
* build host never reports a
|
|
42
|
+
* of its package.json (`<addon>-ios` covers every iOS host) and loads its
|
|
43
|
+
* native code from that package alone. Desktop platform packages install as
|
|
44
|
+
* os/cpu-filtered optionalDependencies, but a build host never reports a
|
|
45
|
+
* mobile os, so mobile ones have to be declared.
|
|
44
46
|
* This declares the missing ones in package.json, pinned to each addon's
|
|
45
47
|
* exact version, using the project's own package manager.
|
|
46
48
|
*
|
|
47
|
-
* A host whose
|
|
48
|
-
*
|
|
49
|
-
* the addon's version. Throws `HostPrebuildsInstallRefusedError` when no
|
|
49
|
+
* A host whose platform package is already installed at the addon's version
|
|
50
|
+
* is skipped. Throws `HostPrebuildsInstallRefusedError` when no
|
|
50
51
|
* supported package manager (npm 7+, pnpm, bun, Yarn Berry) is found, and
|
|
51
52
|
* `HostPrebuildsInstallFailedError` when the install does not produce the
|
|
52
53
|
* packages.
|
|
@@ -68,4 +69,11 @@ export declare function installMissingHostPrebuilds(options: InstallMissingHostP
|
|
|
68
69
|
* the same platform package, since only one version of it can be installed.
|
|
69
70
|
*/
|
|
70
71
|
export declare function findMissingHostPrebuilds(addons: NativeAddon[], hosts: string[]): Promise<HostPrebuildPackage[]>;
|
|
72
|
+
/**
|
|
73
|
+
* The installed addons named in `names`, or every installed addon when
|
|
74
|
+
* `names` is omitted, split addon metas included. For each name the copy in
|
|
75
|
+
* the nearest modules directory wins, as it does for Node's resolver. Without
|
|
76
|
+
* `names`, the packages nested in each package's own node_modules count too.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveAddons(projectRoot: string, names: string[] | undefined, logger: Logger): Promise<NativeAddon[]>;
|
|
71
79
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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)
|
|
17
|
-
*
|
|
18
|
-
* build host never reports a
|
|
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
|
|
23
|
-
*
|
|
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
|
|
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
|
-
|
|
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
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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();
|
|
@@ -4,7 +4,7 @@ export { ensureHostPrebuilds } from './host-prebuilds/index.js';
|
|
|
4
4
|
export type { EnsureHostPrebuildsOptions, EnsureHostPrebuildsResult, HostPrebuildPackage, PackageManagerName } from './host-prebuilds/index.js';
|
|
5
5
|
export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from './verify/index.js';
|
|
6
6
|
export type { VerifyBundleOptions, VerifyBundleResult, VerifyBundleIssue, RuntimeGroup } from './verify/index.js';
|
|
7
|
-
export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError } from '../utils/errors-client.js';
|
|
7
|
+
export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError, HostPrebuildsMissingError } from '../utils/errors-client.js';
|
|
8
8
|
export { formatRuntimeSource } from './verify/abi.js';
|
|
9
9
|
export type { BareRuntime, BareRuntimeResolution } from './verify/abi.js';
|
|
10
10
|
export { isReactNativeBareKitInstalled } from './verify/bare-kit-runtime.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { bundleSdk } from './bundle/index.js';
|
|
2
2
|
export { ensureHostPrebuilds } from './host-prebuilds/index.js';
|
|
3
3
|
export { verifyBundle, hasErrors, hasWarnings, formatVerifyBundleResult } from './verify/index.js';
|
|
4
|
-
export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError } from '../utils/errors-client.js';
|
|
4
|
+
export { HostPrebuildsInstallFailedError, HostPrebuildsInstallRefusedError, HostPrebuildsMissingError } from '../utils/errors-client.js';
|
|
5
5
|
export { formatRuntimeSource } from './verify/abi.js';
|
|
6
6
|
export { isReactNativeBareKitInstalled } from './verify/bare-kit-runtime.js';
|
|
7
7
|
export { isMobileHost } from './verify/prebuilds.js';
|
|
@@ -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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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))
|
|
@@ -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 = {
|
|
@@ -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
|